If you want to capture the output from executing a program, use
_popen()
. eg
#include <iostream>
#include <cstdio>
int main()
{
FILE *pipe = _popen("ipconfig", "r");
if(pipe == NULL) {
perror("popen");
return 1;
}
char buffer[256];
while(fgets(buffer, sizeof buffer, pipe) != NULL) {
std::cout << buffer;
}
_pclose(pipe);
return 0;
}