title: Why would I need use fflush on stdout before writing to stderr?
body: <p>I am reading 'UNIX Network Programming: The Sockets Networking API' and in the example code they have an error handling function which contains the following lines:</p>
  
  <pre><code>fflush(stdout);     /* in case stdout and stderr are the same */
  fputs(buf, stderr);
  fflush(stderr);
  </code></pre>
  
  <p>Where buf contains the error description. I don't understand why fflush is used on stdout on the first line and why the comment explains the reason for its use.</p>