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/进程?


基础教程推荐
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 从 std::cin 读取密码 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01