可能重复:
How to execute a command and get output of command within C++?撰写过程的输出缓冲器
在我的C++程序,我正在使用execv /系统的外部程序。
我想程序的一个缓冲区输出重定向在我的程序,即:
char* buff[some size large enough for any possible output];
system(some program);
//THE PROGRAM I JUST RAN IS A SPECIAL BLACK BOX PROGRAM THAT RUNS
//AND PARSE AN HTTP DUMP FILE AND PRINTS IT TO THE SCREEN WHEN RUNNING
//I WANT THE OUTPUT TO GO A BUFFER IN MY PROGRAM.
//THE IDEA IS TO HAVE THE DATA OF THE OUTPUT ON THE BUFFER RATHER THAN ON A FILE
//have the buffer filled with the output of the program
感谢:-)
下次搜索:http://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get- output-of-command-within-c –