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/进程?
基础教程推荐
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
