Interface with a precompiled program

53 views Asked by At

How do I take an already - compiled program (Console App) and communicate with it via my C++ code? Such that "printing" into the program will be the same as a user that types what I print into the console of the program, and "reading" from it read what the program as written into the console?

Here is a pseudocode of what I want (preferably without external libraries):

//also start (run) the program somehow
ProgramStream programStream = createStream("somepath/someprogram.exe")

programStream << "This will be written into the console of someprogram.exe" <<endl;

string result;
ProgramStream >> result; //gets what the program prints back


0

There are 0 answers