c – 启动进程并重定向其stdio的跨平台方式

我想知道是否有一个跨平台(
Windows,
Linux,BSD)库,我可以使用它来异步启动进程并为其标准管道提供类似iostream的包装器.

我希望它能够告诉进程何时终止.

谢谢.

最佳答案 您可以使用2个库:

另外,QProcess

您可以使用Qt工具包中的QProcess类.
更多信息可以在this stackoverflow questionqt library找到.

libexecstream

这个library比Qt轻,是跨平台的

其他

> pstreams发布0.17

If you only want a console application you can use the old popen-based branch (release 0.17), which uses the Win32 functions _popen() and _pclose(), but these will not work in a GUI program (and might blow up your PC, if Windows doesn’t do it for you.) This version doesn’t have most of the library’s features and is no longer maintained or tested.

点赞