I am looking for a way to have my C++ program communicate with Stockfish. An ideal solution would use the compiled version and my program would send commands to the .exe which would return the results. I have looked extensively and have come across suggestions for pipes or the use of the system function but I am not sure how either of those work and if it's possible to have information returned to my C++ program. I am running on Windows. Any suggestions on what method to use and direction on how to apply that method would be greatly appreciated.
The code required for this is platform dependent, so it may be pragmatic to use a third party API to handle inter-process communication for you. Boost provides
Boost.Process and Qt provides
QtProcess, both of which allow for communication via stdin and stdout.
Otherwise, you will have to directly interact with platform specific APIs, such as
CreateProcess on Windows and
pipe, etc. on Linux.
Once you are able to communicate with the engine, you just need to follow the UCI Protocol (which is used by Stockfish) to communicate with the engine.