terminal command in c program
hi guys
I want to design c program can run terminal command and put the output of command into file... How can i do this ? for example : string s = " iwlist scan " and when i run the programm this command applied and put the output into specific file plz help me |
Been a while since I did c, but i believe you're looking for the "system" call, as for putting it in a specific file... you could just specify it in the command itself--
system("/usr/local/sbin/command > /tmp/out-file"); Generally speaking, its far easier to write a bash or perl script than a c program when you're heavily interacting with system and you may want to look at those routes depending on what the end goal is here. |
All times are GMT -5. The time now is 11:41 AM. |