Re: Linux: Unbuffered reading from stdin



Am 22.10.2007 13:24 postulierte Markus Mayer folgendes:
[...]
2) What happens when the user presses just ESC? Sounds easy to me, just
check if there are no more chars in stdin - but how do you do that? By
just read()ing STDIN_FILENO after an ESC the terminal is blocked until
another key is pressed - that is not really what I want.

D'oh ... that was a dumb one. By reading a maximum of n bytes into the
buffer I can check bytes 2..n if buffer[0] is 27. Okay - done.

Are there other solutions though?

Regards,
Markus
.