Kbhit function under SCO Unix 3.2 Development

Ronald S H Khoo ronald at robobar.co.uk
Sat May 25 05:24:07 AEST 1991


joe at proto.com (Joe Huffman) writes:
> root at 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 <stdio.h>
	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 <ronald at robobar.co.uk> +44 81 991 1142 (O) +44 71 229 7741 (H)



More information about the Comp.unix.sysv386 mailing list