PHP 中有一个方便的函数,叫做proc_open http://php.net/manual/ru/function.proc-open.php。它可用于调用可执行文件,打开其stdin
, stdout
and stderr
作为管道。
这个函数在 C++ 中有一个好的跨平台版本吗?唯一可以谷歌搜索的是this http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499%28v=vs.85%29.aspxWindows 教程(尽管其中的代码只是挂起)。
你可能会到达“某个地方”
popen
(http://linux.die.net/man/3/popen http://linux.die.net/man/3/popen)
流库 http://pstreams.sourceforge.net/(POSIX 过程控制)- 我以前没有这方面的经验,但它看起来很可靠,并且是由 Jonathan Wakely 编写的
-
升压过程(http://www.highscore.de/boost/process/ http://www.highscore.de/boost/process/,尚未升压)
- 也可以看看如何在 Boost.Process 0.5 中将程序终止与流结束绑定在一起? https://stackoverflow.com/questions/12329065/how-to-bind-program-termination-with-end-of-stream-in-boost-process-0-5/12376196#12376196
- and 使用 c++ 中的 boost 进程库输出 https://stackoverflow.com/questions/16130387/output-with-boost-process-library-in-c
-
Poco::进程launch
(http://www.appinf.com/docs/poco/Poco.Process.html#13423 http://www.appinf.com/docs/poco/Poco.Process.html#13423)
static ProcessHandle launch(
const std::string & command,
const Args & args,
Pipe * inPipe,
Pipe * outPipe,
Pipe * errPipe
);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)