Author: Dieter Buerssner
Date: 09:26:13 12/12/01
Go up one level in this thread
On December 12, 2001 at 11:43:05, Severi Salminen wrote: >>In what language? At what platform? It can't be done in any portable fashion. > >Oh, sorry, I forgot to tell. PC/WIN98 and Visual C++ 6.0. And I have done it in >C only, so no C++. I hope this info might help :) In the other post, you said, you wanted no multithreading approach. It might be enough for you, if you read the documentation of PeekNamedPipe. This function can tell you, if there is input available from the pipe between WB and your engine. For non-WB mode, you can use _kbhit(). Essentially the same code samples can be found in Crafty, Amy, Arasan, ... which (I believe) don't use multithreading for input processing. Some care must be taken, when using buffered Standard C input functions for reading stdin. Because the first usage of such a function will copy a lot (or all) of the contents "waiting" in the pipe to the buffered I/O system. So, now input may be waiting there, while PeekNamedPipe will show no input available. An unportable way to check for this, is looking at stdin->_cnt, which will be nonzero when input is waiting there. I personally find the Unixish select() method cleaner. Perhaps, some compability library is available for this. Regards, Dieter
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.