Pursuant to my earlier question, I'm trying to determine if I can read a byte without blocking.
Now, I've got several solutions that work for Unix-like systems, but they all crash and burn when trying to port it to windows, because it simply does not follow the unix "everything is a file" motto. On windows, there's no termios
to flip the terminal into non-canonical mode, fstat
doesn't tell you anything, and although WSA ostensibly offers select
and more recently, poll
, they only work on sockets, not any old file handle, and NOT the console "file".
So my only thought from checking through the MSDN is to get the count of input events, peek a copy and iterate through it, counting only KEY_UP typed events. But ... ick?! help? better way? or even a little less abominable?