Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Winboard problem (maybe Delphi only )

Author: Tony Werten

Date: 15:31:00 08/23/03

Go up one level in this thread


On August 23, 2003 at 10:36:35, Dieter Buerssner wrote:

>On August 23, 2003 at 09:17:45, Tony Werten wrote:
>
>>On August 22, 2003 at 20:40:06, Dann Corbit wrote:
>>
>>>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.
>>
>>This makes sense also because I started to have more problems when I started to
>>write more.
>
>I don't need to set stdout to unbuffered mode (I do need it for stdin). I also
>cannot see, why it should be needed. At points, where the engine wants, that the
>GUI sees what is written, it can (and must, if not set to unbuffered) flush
>stdout.
>
>It seems somehow, that writeln tries more than C streams. Perhaps it even closes
>and reopens the output handle in some situation behind the scenes?

You seem to be correct.

Andreas Herrmann gave me some code that flushes after every character written (
so not using writeln but just write) that seems to work correctly.

So, a flush after every character, lots of more flushes, and it seems to be
working correct. It looks like the problem wasn't in the flush but in the
writeln.

Tony

>
>Are you sure, that the "exited unexpectadly" comes from the output pipe of the
>engine? I just browsed very fast over WB source. I don't understand much of it,
>but it seems to come from the input pipe of the engine.
>
>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.