Logged In: YES
user_id=21627
I think this code is way too fragile to be applied to 2.4.
As for specific errors I could find:
- if the system is not windows, it invokes select
unconditionally; this should be conditioned with HAVE_SELECT
- the Windows version uses kbhit; this may or may not
operate on the same handle as hStdIn. In fact, it likely is
a different handle. See the source code of the crt: kbhit
uses _coninpfh, which is created from opening CONIN$. Try
using GetNumberOfConsoleInputEvents/PeekConsoleInput
instead, checking for a KEY_EVENT event.
- as stdin may be buffered, it may be the case that there is
already input available, even though the file descriptor is
not ready.
|