Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Winboard problem (maybe Delphi only )

Author: Anthony Cozzie

Date: 19:09:00 08/22/03

Go up one level in this thread


On August 22, 2003 at 20:40:06, Dann Corbit wrote:

>On August 22, 2003 at 17:55:43, Tony Werten wrote:
>
>>Hi all,
>>
>>I have found some strange problem in my engine wich only happens every now and
>>then.
>>
>>Somewhere in the middle of a game, winboard will report "first engine (c:\xinix
>>) exited unexpectedly".
>>
>>I have enabled my interface however and I see my engine is still running nicely,
>>but winboard doesn't recieve it's output anymore ( Normally if I start writing
>>to winboard without being started as a winboard engine it will immediately crash
>>)
>>
>>If I press OK (in the winboard dialog with the error) I see my engine recieving
>>a quit and it nicely quits.
>>
>>I use "read" to read from winboard and "writeln" with a "flush" to write. (Both
>>from or to the standard in/out)
>>
>>Has anybody seen this happen before ? Is it possible to break an anonymous pipe
>>in 1 direction only anyway ?
>>
>>cheers,
>>
>>Tony
>>
>>PS Delphi 5, windows xp
>
>In C or C++, you need to turn ALL buffering OFF for standard in put and output.
>
>In C:
>setbuf(stdout, NULL);
>setbuf(stdin, NULL);
>setvbuf(stdout, NULL, _IONBF, 0);
>setvbuf(stdin, NULL, _IONBF, 0);
>
>In C++:
>cout.rdbuf()->setbuf(NULL,0);
>cin.rdbuf()->setbuf(NULL,0);
>
>Probably, that is the problem.  I imagine that there is a way to turn off
>buffering completely in Delphi, but I am not terribly familiar with the
>language.

Could you explain your C code?

For years Zappa has used the standard setbuf(stdout, null) from the Winboard
engine-intf guide.  According to my linux man pages,
---------------------------------
 The other three calls are, in  effect,  simply  aliases  for  calls  to
       setvbuf.  The setbuf function is exactly equivalent to the call

              setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
------------------------------
So, aren't the setvbuf() commands unnecessary? Or were you simply giving more
examples? Or am I missing something?

anthony



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.