title: Removing trailing newline character from fgets() input
body: <p>I am trying to get some data from the user and send it to another function in gcc. The code is something like this.</p>
  
  <pre><code>printf("Enter your Name: ");
  if (!(fgets(Name, sizeof Name, stdin) != NULL)) {
      fprintf(stderr, "Error reading Name.\n");
      exit(1);
  }
  </code></pre>
  
  <p>However, I find that it has a newline <code>\n</code> character in the end. So if I enter <code>John</code> it ends up sending <code>John\n</code>. How do I remove that <code>\n</code> and send a proper string.</p>