从系统捕获标准输出()命令优化 [英] Capturing stdout from a system() command optimally
本文介绍了从系统捕获标准输出()命令优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想开始通过外部应用系统()
- 例如,系统(LS)
。我想正好捕捉到它的输出,所以我可以把它送到作进一步处理另一个功能。什么是最好的办法,在C / C ++?
I'm trying to start an external application through system()
- for example, system("ls")
. I would like to capture its output as it happens so I can send it to another function for further processing. What's the best way to do that in C/C++?
推荐答案
器一起手册:
#include <stdio.h>
FILE *popen(const char *command, const char *type);
int pclose(FILE *stream);
这篇关于从系统捕获标准输出()命令优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文