Author: Alessandro Scotti
Date: 08:25:26 08/30/04
Go up one level in this thread
On August 30, 2004 at 10:20:05, Robert Hyatt wrote: >What do you do about the case where you type "command"<CR> "command"<CR> (two >commands) before your program does the "check for input"? You do the first >fgets() and the C library sucks both commands into its internal buffer, by >reading the data from the O/S, and it gives you the first command. Now when you >ask "is there more input" you are asking the O/S and it says "no" even though >the C library has the second command in its buffer. This is a _common_ problem >when people first modify their engines to run with winboard/xboard. It is such >a problem that Tim and I wrote a lot of text to explain why this is a problem >and how to get around it... Well I don't know because I've never found this problem in any of my prototypes. Maybe it's the mix of asking both the O/S and the standard lib that messes things up. I have a separate thread that performs fgets (I also tried fread and ReadFile and they work as well) and simply blocks if there is nothing to get. I have just tried the experiment you suggested and it works fine, probably because I always use fgets() so I'm reading from the same buffer.
This page took 0.01 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.