Computer Chess Club Archives


Search

Terms

Messages

Subject: questions about using fget as waiting loop

Author: Uri Blass

Date: 09:04:47 08/29/04


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.

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()

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?

Uri





This page took 0.01 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.