Author: Reinhard Scharnagl
Date: 12:32:20 08/29/04
Go up one level in this thread
On August 29, 2004 at 12:04:47, Uri Blass wrote: >I have the following code similiar to tscp (tscp is using the variable line >instead of buffer. > >if (!fgets(buffer, 256, stdin)) > return; > >I have the following questions: >1)How is it possible to have >!fgets(buffer, 256, stdin) > >I understand that it happens only in case of an error but >I do not see how there can be an error. May be that the sitiation is not caused by an error, but simply by an EOF or Ctrl^Z input when been called via a command promt. >2)Is it safe to use fgets()? >I remember that it is not safe to use gets() and I think that for the same >reason it is not safe to use fgets() In contrast to that idea fgets() is save, but please make the buffer 1 char longer than the parameter amount. >3)I plan to replace this code by a waiting function. >The point is that I need to wait passively to commands in different places >one case is when I do not ponder and it is the opponent move but even when I >ponder during the search I may want to wait(for example if I finished the >maximal depth). > >Today movei has no waiting function and in case of finishing to search during >pondering it simply unmake the pondered move and go to the main loop. > >I think that it is better not to finish the search in case of pondering and >simply call wait during the search to wait passively to winboard command when >wait may call a function that read wb input during searching(can be ponder mode >play mode or analysis mode). > >Do you have a waiting function in your code? I work with threads, and wait by sleeping some fractions of seconds. >Uri Regards, Reinhard.
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.