title: Printing error messages
body: <p>I am just wondering what is the best way to make custom print error functions.</p>
  
  <p>For example I have some #defines like this in header file:</p>
  
  <pre><code>#define SOCKET_ERR 0
  #define BIND_ERR   1
  #define LISTEN_ERR 2 
  etc
  </code></pre>
  
  <p>Then maybe using this like this:</p>
  
  <pre><code>if(/*something has gone wrong with socket*/)
  {
     print_error(SOCKET_ERR);
  }
  
  print_error(int error)
  {
     if(error == 0)
     {
         printf("Socket failure\n");
     }
  }
  </code></pre>
  
  <p>However, I don't think this perfect and want to do something much better. Maybe something a little bit more professional and maybe more scalable.</p>
  
  <p>Many thanks for any advice,</p>