Author: Heiner Marxen
Date: 12:06:24 10/25/03
Go up one level in this thread
On October 25, 2003 at 14:29:32, Matthias Gemuh wrote: >> >>void uci_wait_for_command() { >> char command[10000]; >> >> fgets(command, 10000, stdin); >> uci_handle_command(command); } >> > > >Plus '\0', you try to allocate space for 9999 bytes, then you try to stuff >10000 bytes into that space. > >/Matthias. No, the code is ok. Citing from my man page: char *fgets(char *s, int size, FILE *stream); fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer. Heiner
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.