Non-destructive read of keyboard buffer

Charles Hannum mycroft at kropotki.gnu.ai.mit.edu
Sat Jun 8 16:09:01 AEST 1991


In article <22368 at duke.cs.duke.edu> jit at slic.cellbio.duke.edu writes:

   Hi, I am trying to find out if a keyboard buffer is empty but not reading
   it because I don't want to get stuck if there isn't any buffered.
   (on ATT SVR3)

   Is there a 'standard' way on unix to do this ?

You can use select(2) under BSD, or set the terminal to non-blocking I/O
(using the FIONBIO ioctl), try to read, and see if you get EWOULDBLOCK.

Details available upon request.  B-)



More information about the Comp.unix.programmer mailing list