首页 > 解决方案 > 与预编译程序的接口

问题描述

如何获取已编译的程序(控制台应用程序)并通过我的 C++ 代码与其通信?这样“打印”到程序中将与将我打印到程序控制台中的用户键入相同,并从中“读取”读取程序写入控制台的内容?

这是我想要的伪代码(最好没有外部库):

//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


标签: c++consoleiostreaminterfacing

解决方案


推荐阅读