title: perror() or own string output to stderr in C
body: <p>Is there a preferable way to report errors in C? For example if a file that is supposed to be opened does not exist, should I use</p>
  
  <pre><code>if( fp == NULL ) 
  {
        perror("Error: ");
        return(-1);
  }
  </code></pre>
  
  <p>(copied from <a href="http://www.tutorialspoint.com/c_standard_library/c_function_perror.htm" rel="nofollow">http://www.tutorialspoint.com/c_standard_library/c_function_perror.htm</a> )</p>
  
  <p>or </p>
  
  <pre><code>if( fp == NULL ) 
  {
        fprintf(stderr, "Unable to open file for reading.\n");
        return(-1);
  }
  </code></pre>