Xref: utzoo comp.lang.c:39569 comp.unix.sysv386:8399 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!stl!robobar!ronald From: ronald@robobar.co.uk (Ronald S H Khoo) Newsgroups: comp.lang.c,comp.unix.sysv386 Subject: Re: Kbhit function under SCO Unix 3.2 Development Message-ID: <1991May24.192407.5302@robobar.co.uk> Date: 24 May 91 19:24:07 GMT References: <170@swatty.UUCP> <1991May24.015704.14338@proto.com> Followup-To: comp.unix.sysv386 Organization: Robobar Ltd., Perivale, Middx., ENGLAND. Lines: 26 joe@proto.com (Joe Huffman) writes: > root@swatty.UUCP (Larry Krone) writes: > >In dos, I can use the kbhit function...Is there an equivalent under > >SCO Unix ....If so, what is it??? > > If you were compiling with the Zortech compiler for SCO UNIX it would be > kbhit(), same as DOS. Library source code is available (for a price...). > > See the FAQ in comp.unix.questions or c.u.programmer for some hints. Also, this is the wrong newsgroup. Followups are redirected. But to answer the original question: For many cases: /* cheaper than buying zortech :-) */ #include int kbhit() { return rdchk(fileno(stdin)) != 0; } will do, but only under Xenix and Unix SYSVR3.2 and higher, linking with the -lx library, but this answer is good enough for the poster of the original question. Of course, you have to setbuf(stdin, (char *)0); at the beginning of the program to make this work. -- Ronald Khoo +44 81 991 1142 (O) +44 71 229 7741 (H)