title: How can I use fprintf and write to a pipe?
body: <p>I created a pipe and I used dup2() to overwrite streams 1 &amp; 2 (stdout &amp; stderr) into those pipes.</p>
  
  <p>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.</p>
  
  <p>Essentially I'm asking, given an int representing the stream, how can I get a FILE* suitable for use in fprintf()?</p>