Results 1 to 2 of 2
Hello,
I am using system() command to save command output in txt file and i am storing in one character variable. for example
Code:
system("ls>output.txt");
but what should i do ...
- 02-16-2010 #1Linux User
- Join Date
- Aug 2008
- Location
- Trichy,India
- Posts
- 308
saving output in file
Hello,
I am using system() command to save command output in txt file and i am storing in one character variable. for example
but what should i do when i have to save another one command output in the same txt file continuously, for exampleCode:system("ls>output.txt");
the output of these 2 commands should come in one txt file continously it should get over write.Code:system("ls>output.txt"); system("lsmod>output.txt");Thanks in advance...
- 02-16-2010 #2Linux Newbie
- Join Date
- Dec 2009
- Posts
- 241
> Means write in the file, create if it doesn't exist
>> Means append to file, create if it doesn't exist
So just write:
Code:system("ls>output.txt"); system("lsmod>>output.txt");


Reply With Quote