Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: polling stdin

Author: Andrew Williams

Date: 04:13:13 07/27/03

Go up one level in this thread


On July 27, 2003 at 06:41:28, martin fierz wrote:

>hmm, i'm feeling a bit stupid, perhaps somebody can help me: i want to detect
>when there is input for my engine, but i'm doing something wrong. functions like
>getc() don't return if there is no input, and the function kbhit() which works
>fine in console mode doesn't seem to work when the engine is started by a GUI.
>what function can i use to check whether there is input at stdin?
>
>cheers
>  martin

On Unix, you use select().

On Windows, it's a bit more complicated, I think. Tim Mann has something that
might be helpful:

http://www.tim-mann.org/xboard/engine-intf.html#6

If you look at what he says about PeekNamedPipe and GetNumberOfConsoleEvents
that
might help. Alternatively, try typing those things into Microsoft's online
knowledgebase thingy. I've found that very helpful in the past.

Andrew



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.