Author: Tord Romstad
Date: 08:14:23 10/26/03
Go up one level in this thread
On October 26, 2003 at 10:13:48, Eiko Bleicher wrote: >>>>void uci_wait_for_command() { >>>> char command[10000]; >>>> >>>> fgets(command, 10000, stdin); >>>> uci_handle_command(command); } >>> > >I don't know your code, but if command is a local variable, its allocated space >is destroyed when the function returns. > >Are you sure (I mean very sure ;-)) that it crashes in the fgets()? It definitely seems so. I tried inserting a printf statement directly before and after the call to fgets (and made sure the output was flushed, of course), and at the beginning of the uci_handle_command function. >It might crash in the uci_handle_command() function, if i. e. it starts a new >thread and keeps using this buffer, or it just copies that command-pointer to >another variable and then returns. No, it does nothing like that. >Then, if it is used later, the command buffer is void, but still references to >it exist. > >Just an idea :-) Happy hunting! Thanks! I have temporarily chosen the workaround of a global variable (because I had to release this version today), but I will of course return to the problem as soon as I can find the time. Tord
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.