launch an exe/process with stdin stdout and stderr?

后端 未结 3 1789
北海茫月
北海茫月 2020-11-28 11:05

With C++ how do i launch an exe/process with stdin stdout and stderr? I know how to do this in .NET and i remember using popen in the past but popen seems to allow stdin OR

3条回答
  •  没有蜡笔的小新
    2020-11-28 11:12

    You shoud use CreateProcess from WinApi. It takes as argument an object of struct STARTUP_INFO type. You can set hStdin, hStdout, and hStderr fields of the object to redirect those streams of child process to file handles you want (file, pipe, socket...)

提交回复
热议问题