LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   saving output in one file (https://www.linuxquestions.org/questions/linux-software-2/saving-output-in-one-file-789389/)

shariefbe 02-16-2010 01:50 AM

saving output in one file
 
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 when i have to save another one command output in the same txt file continuously, for example
Code:

system("ls>output.txt");
system("lsmod>output.txt");

the output of these 2 commands should come in one txt file continously it should get over write.

chrism01 02-16-2010 01:54 AM

Basically, '>' will overwrite/replace the content, '>>' will append the content. Just try it at the bash level first.


All times are GMT -5. The time now is 07:31 AM.