G
Glen
Hi,
I just have a quick question
Im trying to initialize a string (or char) variable with the information
created by the output of a shell (or DOS) command..
Example:
I want to execute a command such as
system("cat /test.txt | grep something ") or whatever DOS or linux command
and assign the output of that command to the variable str;
so I tried
char str[128]="system(\"my_command\")";
then when I do, cout<<str;
I get system(\"my_command\"),
which is the acctual command, and not its output
Is there any way I can do it?
Thank you
I just have a quick question
Im trying to initialize a string (or char) variable with the information
created by the output of a shell (or DOS) command..
Example:
I want to execute a command such as
system("cat /test.txt | grep something ") or whatever DOS or linux command
and assign the output of that command to the variable str;
so I tried
char str[128]="system(\"my_command\")";
then when I do, cout<<str;
I get system(\"my_command\"),
which is the acctual command, and not its output
Is there any way I can do it?
Thank you