I have a parent process which forks out a child to perform execv().
I need the output given by execv() to stdout to be displayed onscreen as also copied to a log ...
I'm using fork(). However, before executing fork(), I open a file (say a.txt) using freopen for writing. Now the child process redirects the output of execlp to a.txt. After terminating ...
I want to switch between writing to the file and to the stdout
I can't use fprintf, but only printf and freopen
something like this: