Author: Jan K.
Date: 15:20:10 09/17/04
Go up one level in this thread
On September 17, 2004 at 18:04:48, martin fierz wrote: >aloha! > >i just spent friday night implementing pondering in my chess program. hmm, make >that 3 questions, the first being "should i get a life?" :-) > >anyway, back to the two questions - they are really rather stupid, but well... > >1) i'm using PeekNamedPipe to look whether there is any command for my program, >and i'm looking for "ponderhit". when i find that, i'd like to flush the >standard input. however, "fflush(stdin);" doesn't help, the ponderhit command >stays where it is and is seen by every next call to my standard-input-polling >function. i now use "gets(input)" where input is a string, and then the >ponderhit command disappears and is not seen by the next call to PeekNamedPipe. > >can somebody tell me why fflush(stdin) won't work? I can't help, i had problems with this too, but what is the most simple thing to do about this polling/stdin stuff is to have own buffer. Poll with PeekNamedPipe, read with ReadFile/_read(no fgets unless you want to wait for commands in the main loop when not searching) to your buffer....then you can do whatever you want...handle the command and delete it or let it stay there, add commands if you want to handle the situation elsewhere...
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.