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 program doesn't seem to be receiving anything on the other side of the pipe. I've tried using printf(), but I'm not sure if this writes to stdout or stream 1 by default. If it writes to stream 1, I guess its a problem somewhere deeper in my code.
Essentially I'm asking, given an int representing the stream, how can I get a FILE* suitable for use in fprintf()?