title: get code line with __LINE__
body: <p>I tried to print the line number of the current code by using:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void err (char *msg)
  {
      printf ("%s : %d" , msg , __LINE__);
  }
  
  int main ( int argc , char **argv )
  {
      ERR ("fail..");
      return 0;
  }
  </code></pre>
  
  <p>But i always get the wrong line number , it should be <code>10</code> instead of <code>5</code> , how can i fix this ?</p>
  
  <p>Also i tried to use some macro:</p>
  
  <p><code>#define ERR (msg) do { printf ("%s : %d\n" , msg , __LINE__); } while (0)</code></p>
  
  <p>and result in error: <code>msg not declared</code></p>