James wrote:
> how do i flush the keyboard buffer?
Do you mean `how do I drain terminal input'?
[Bear in mind that the Linux console behaves as if it were a terminal
connected to a serial port, as this is the traditional means of
interacting with Unix boxes.]
If so, then there are several possible approaches.
a) Use tcdrain() followed by tcflush(). This will empty the TTY
driver's I/O buffers, but won't affect any stdio buffers.
b) Repeatedly read from stdin until no more input is available
according to ioctl(FIONREAD) or select().
c) Enable non-blocking I/O and read() until you get a return value of
-1 and errno is set to EAGAIN.
--
Glynn Clements <[EMAIL PROTECTED]>