Author: Sune Fischer
Date: 03:50:21 04/14/04
Go up one level in this thread
On April 14, 2004 at 06:41:10, Tord Romstad wrote:
>On April 14, 2004 at 05:31:33, Sune Fischer wrote:
>
>>Testing for NULL doesn't seem to work, it still hangs when the GUI crashes.
>>
>>Perhaps I'm doing it wrong, should it be if (stdin==NULL)?
>
>I do like this:
>
> char command[256];
>
> if(fgets(command, 256, stdin)==NULL)
> strcpy(command, "quit\n");
> handle_command(command);
>
>
>Tord
I do the same, except I'm using a modified fgets():
char *Fgets(char *buf,int cnt,FILE* pstream) {
char *np;
if (fgets(buf, cnt, pstream) == NULL)
return NULL;
if (np = strchr(buf,'\n'))
*np = '\0';
return buf;
}
-S.
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.