Author: Bas Hamstra
Date: 14:26:42 08/27/04
Go up one level in this thread
On August 27, 2004 at 17:20:12, Alessandro Scotti wrote: >I have found similar problems with Windows 2000, also when using the native >Win32 API. I think there might be a bug in how the console standard input is >managed. Here's what I tried: I used one API to peek at the input event queue >and another API (ReadFile) to read characters from the standard input. I typed >"asd" and the event queue contained, correctly, six events corresponding to the >press and release of "a", "s" and "d". When I read from standard input, though, >I got "a?d". This also seems to be worse on slower machines, and only happens >with keyboard input, not with pipes or file redirection. Well they both have the NT kernel, so it's probably related. In my case replacing the normally buffered fgets(Buf, 128, stdin) with the unbuffered read(fileno(stdin), Buf, 128) solved the problem, as Bob pointed out. Bas.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.