Ponder console input move problem
Posted: Wed Apr 28, 2010 11:42 pm
Hi all,
I added ponder to plisk and logically all works fine. I have a problem however with my code that detects if a move is being fed to the program while it is pondering.
In windows I use the usual PeekNamedPipe/PeekConsoleInput and then if anything is there, I do a fgets to get the move string.
If ran under winboard, so with a pipe, everything seems fine. However if I run from the debugger or a console, it breaks. What happens is that when I do fgets the first 2 chars in the string are replaced by 'p' and 0 (so 70 and 0). So a move like "h2h3" gets transformed into 'p',0,'h','3'. Therefore making it very hard for me to debug some issues I have.
Maybe a memory corruption issue, but why does it not happen in pipe mode? Must be something stupid I do but for the life of me I cannot figure it out.
Has anyone seen anything like this?
Regards,
Vlad.
I added ponder to plisk and logically all works fine. I have a problem however with my code that detects if a move is being fed to the program while it is pondering.
In windows I use the usual PeekNamedPipe/PeekConsoleInput and then if anything is there, I do a fgets to get the move string.
If ran under winboard, so with a pipe, everything seems fine. However if I run from the debugger or a console, it breaks. What happens is that when I do fgets the first 2 chars in the string are replaced by 'p' and 0 (so 70 and 0). So a move like "h2h3" gets transformed into 'p',0,'h','3'. Therefore making it very hard for me to debug some issues I have.
Maybe a memory corruption issue, but why does it not happen in pipe mode? Must be something stupid I do but for the life of me I cannot figure it out.
Has anyone seen anything like this?
Regards,
Vlad.