title: C modifying printf () to output to a file
body: <p>Is there a way to modify the <code>printf</code> in order to output string on a file rather than to the console?</p>
  
  <p>I tried looking up something on the Internet and found calls like <code>dup</code>, <code>dup2</code> and <code>fflush</code> that might be associated with this.</p>
  
  <p>EDIT:</p>
  
  <p>Maybe I wasn't clear.. the thing is that this was in a C exam question.. the question is as follows: </p>
  
  <p>Explain how a program that normally output strings to screen (using <code>printf()</code>) can be made to output string to a file, <strong>without</strong> changing any code in the mentioned program.</p>