I created a pipe and I used dup2() to overwrite streams 1 & 2 (stdout & stderr) into those pipes.
Now I wish to use fprintf to write to stream 1 or 2, but my pro
If you have a file descriptor and want a FILE*, you can use fdopen
FILE*
fdopen
FILE *fdopen(int fd, const char *mode);
fdopen is a Posix function and documented in man fdopen. To do the reverse you can use fileno
man fdopen