Is there a way to get the output from running another command via execlp to output to a file?
Right now I am experimenting with fopen but I can't figure out what to do..
Any suggestions?
Thank you
Is there a way to get the output from running another command via execlp to output to a file?
Right now I am experimenting with fopen but I can't figure out what to do..
Any suggestions?
Thank you
In the child process, just before the execl call
int fd = open( "file", O_WRONLY );
close( 1 );
dup( fd );
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.