Author: Andreas Herrmann
Date: 04:54:15 08/24/03
Go up one level in this thread
On August 24, 2003 at 06:18:03, Tony Werten wrote: >On August 23, 2003 at 18:31:00, Tony Werten wrote: > >>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. > >I let it run for 12 hours and it worked witout problems. > >There are 2 differences between the "writeln" and the "write" way. > >With write, you send about 20 times as much flushes, but they don't seem to >matter. > >With writeln, you (automaticly) send a #13#10 after each string, with write, (by >hand) only a #10 ( don't know if that's the CR or the LF) After a couple of >hunderds of them, the #13 seem to give problems. > >Or at least that's what sounds logical to me. I should get a real hobby. > >Tony Hi Tony, yes it seems so. I think i have had the same problem before some years, where i have figured that out. (#10=LF; #13=CR) Andreas
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.