All these solutions are for the time before starting the program
execution.
I got two suggestions:
1. Use calls like dup and dup2
2. Use things like ./prog >r1.txt 2>r2.txt
But for using the first solution, I need to modify program source which I
dont have.
The second solution is worthwhile only before I start the program. But
what I need to do is readjust streams at runtime. For eg., suppose a
program is running and I see some interesting output on some screen. I
want to redirect it to a file now... How do I do that, without stopping
the process !
Now, I want to
redirect the STDOUT and STDERR of the
running background process to some files , say r1.txt
r r2.txt without stopping or affecting the process.
You can do the following:
./prog >r1.txt 2>r2.txt &
--
**********************************************************
* Never say die unless you are dead ! *
* .oooO *
* ( ) Oooo. Only those who will risk going too far *
* \ ( ( ) Can possibly find out how far one can go!*
* \_) ) / *
* (_/
http://www.it.iitb.ac.in/~akhilesh/ *
**********************************************************