[comp.lang.c] Re^2: How to test if a key has been hit w/o waiting for a key ?

sleepy@wybbs.mi.org (Mike Faber) (05/04/90)

I missed parts of this, but couldn't you use ioctl?  
Set yourself up as nonicanonical processing, and in the array struct.c_cc,
set the VMIN element (struct.c_cc[VMIN]) to 0 and VTIME element to 1.  Then a
getchar() or getc()  will return -1 if no characters were received.
If you want to put it back, ungetc(or something like that) is supposed to
work...