Getting the output of an external program
Posted on 2007-04-04
I need a program that does the following in linux:
Run an external program eg. system("ls -l") and then parse the output of the external program.
One way is to redirect the output of external program to a file and then my program parse the file.
However, I need to do this many times in the program and need it to be fast.
Is there anyway in C I can get the output of the external program straight into an array in my program?
Cause I don't want to first write to a file and then later open the file and parse it (too slow).