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.
Last edited by rweaver; 05-21-2010 at 11:10 AM.
|