Author: Dieter Buerssner
Date: 21:50:34 11/04/02
Go up one level in this thread
On November 04, 2002 at 17:19:30, Severi Salminen wrote:
>I try to get the WinBoard interface working without disabling input buffering.
>Disabling the buffer by setbuf(stdin, NULL) causes problems with WB. But I have
>also a problem _without_ disabling the buffer:
>
>These are send to engine:
>
>7360 >first : time 5794
>otim 5935
>7360 >first : usermove 7360 >first : g1f3
>
>PeekNamedPipe reports 34 bytes in pipe. After 1st fget() I get only the first
>command (time 5694) but after that PeekNamedPipe tells that 0 bytes available in
>pipe. When doing a fget() after this I can, however, read the next command. So,
>the question: how can I fetch these commands so that PeekNamedPipe doesn't get
>confused -> after first fget(), PeeknamedPipe should give 24 bytes available,
>not 0. fget clearly is not the right function, but others seem to behave
>identically.
Do you mean fgets() instead of fget()?
At the point where you call PeekNamedPipe, also look at the buffer of stdin.
This is only possible by system specific code. Under Windows:
if (stdin->_cnt > 0)
{ /* Input available */ }
For Unix, using select together with setting stdin to line buffered mode seems
to work for me.
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.