Author: James Swafford
Date: 09:27:07 09/05/99
Go up one level in this thread
On September 05, 1999 at 11:45:36, Nicolas Carrasco wrote:
>Dear Guys,
>
>Now I am able to comunicate my chess engine to Winboard but I only want to ask
>you some questions to know if I can have any problems because at the file
>included at Winboard.
>
>What this function do ?
>setbuf(stdout, NULL);
This function flushes your output to the console, so that
it doesn't get buffered. (i.e. if you output "e4", you want
it to be sent *right away*.)
>
>At winbord´s protocol file says that "scanf" can have problems so I created my
>own function:
>////////////////////////////////////////////////////////////////////
>#include <stdio.h>
>
>void cgets ( char *buffer )
>{
> char i, ch;
> /* Read in single line from "stdin": */
> for( i = 0; (i < 80) && ((ch = getchar()) != EOF) && (ch != '\n'); i++ )
> buffer[i] = (char)ch;
>
> /* Terminate string with null character: */
> buffer[i] = '\0';
>}
>/////////////////////////////////////////////////////////////////
>
>I think with this works fine!
>
>But, can I use printf to comunicate Winboard succesfuly ?
>
>How crafty thinks and gets text at the same time?
>
>Thanks
If you can compile C++, you may want to consider using cin
and cout. I don't know what the problem is with scanf( ),
but I haven't had any problems with cin.
--
James
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.