Many people get stuck when trying to read the input given by the GUI. Especially during search
and ponder search. Another problem is that there is a difference between keyboard input in the
console and input from the GUI. The advice is often to use these weird windows functions like
PeekNamedPipe, GetConsoleMode, GetNumberOfConsoleInputEvents and so on. I don't even
understand what all these functions do and what their parameters represent.
Instead I found that a separate input thread is much cleaner to work with. All you have to know is
some basic things about setting events and waiting for events in order to synchronize the main
thread with the input thread. An input thread doesn't cost more in performance. It mostly stands
still waiting for input.
Here is a template that I cut out from Alaric and cleansed from unnecessary stuff. It can read uci
commands and starts a faked search that can be stopped by 'stop' or it will get timed out after 10
seconds.
Start it in the debugger and check out how it works under the console.
___________________________