Author: Dieter Buerssner
Date: 12:06:13 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. No. First, fgets() will not receive anything close to 10000 chars in the decribed scenario. Second, fgets() really expects the size of the buffer, not the number of chars without \0 that can be stored there. fgets reads at most one less character than the number given. Unless fgets has a bug ... I would use fgets(command, sizeof command, stdin); in this situation, however. But it should of course not make a difference. Regards, Dieter
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.