c++ - 使用 stdin stdout 和 stderr 启动 exe/进程?

标签 c++ process stdout stdin stderr

在 C++ 中,我如何使用 stdin stdout 和 stderr 启动 exe/进程?我知道如何在 .NET 中执行此操作,我记得过去使用过 popen,但 popen 似乎允许 stdin 或 stdout,但不能同时允许 stdin 或 stdout,也不能同时允许 3 个。

我需要它用于 windows,但欢迎使用 linux 解决方案,因为我将来会在同一个项目中需要它。

最佳答案

可移植解决方案是 boost.process

(注意:这已被提议作为 Boost 库,并在相同的许可条款下发布,但未被正式接受。另请参见 Where is Boost.Process?)

关于c++ - 使用 stdin stdout 和 stderr 启动 exe/进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5485923/

相关文章:

python - Twisted:在延迟的子进程和 http 请求之间进行通信?

process - 代码质量: how to measure developers performance?

windows - 使用标准 io 流 :stdin and stdout in a matlab exe

c++ - 在将 lambda 作为参数传递时,我应该避免强制转换为 std::function 吗?

c++ - 如果实例化为整数类型,则使模板函数在内部使用浮点类型

c++ - 线程本地存储 (TLS) 和 OpenMP

C++ - 当输出到文本文件与控制台输出不同时,string.compare 问题?

java - 我可以让 Java 应用程序等待后台进程完成吗?

c - 如何用 C 语言打印哈希表?

go - 通过 SSH 流式传输 Stdout 和 Stderr,操作流然后打印到本地 Stdout 和 Stderr