你如何从C ++中的windows命令读取控制台输出?

时间:2011-03-27 17:37:43

标签: c++ windows

  

可能重复:
  How can I run an external program from C and parse its output?

如果从程序内部运行Windows命令(比如以ipconfig为例),您如何阅读系统返回程序进行处理的输出?

1 个答案:

答案 0 :(得分:3)

请参阅MSDN上的Creating a Child Process with Redirected Input and Output

或者,您可以使用_popen来简单捕获输出。