-
System Commands Output
I want to save the output of system command in the memory location.For example the following command will save the output in the file /tmp/lsfile.txt.
system("ls -al > /tmp/lsfile.txt");
Rather than saving it in file is it possible to save it in some string variable or any other data structure?Does any on know?
-
There probly is, but if you want a temporary solution just load the file.
-
Yes there is. try this:
Code:
FILE *fp;
fp=popen("ls -al", "r");
/* read from "fp" using f***-functions */
pclose(fp);
alex