launch an exe/process with stdin stdout and stderr?(使用 stdin stdout 和 stderr 启动 exe/进程?)
问题描述
使用 C++,我如何使用 stdin stdout 和 stderr 启动 exe/进程?我知道如何在 .NET 中执行此操作,我记得过去使用过 popen 但 popen 似乎允许 stdin 或 stdout 不是两者都允许,也不是全部 3.
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 stdout not both and not all 3.
我需要在 Windows 上使用它,但欢迎使用 linux 解决方案,因为我将来会在同一个项目中使用它.
I need this for windows but a linux solution is welcome as i'll need it for the same project in the future.
推荐答案
可移植的解决方案是 boost.process
(注意:这已被提议为 Boost 库,并在相同的许可条款下发布,但未正式接受.另见 Boost.Process 在哪里?)
(Note: this has been proposed as a Boost library, and released under the same license terms, but not officially accepted. See also Where is Boost.Process?)
这篇关于使用 stdin stdout 和 stderr 启动 exe/进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 stdin stdout 和 stderr 启动 exe/进程?


- 如何对自定义类的向量使用std::find()? 2022-11-07
- 静态初始化顺序失败 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- 近似搜索的工作原理 2021-01-01
- C++ 协变模板 2021-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 从python回调到c++的选项 2022-11-16