title: Best way to strip out a NL
body: <p>I tried this but it's not working for me:</p>
  
  <pre><code>char * remove_nl(char * newstr)
  {
      newstr = strdup(newstr);
      newstr[strlen(newstr)-1] = '\0';
      return newstr;
  }
  </code></pre>