title: Does fgets() always terminate the char buffer with \0?
body: <p>Does fgets() always terminate the char buffer with \0 even if EOF is already reached? It looks like it does (it certainly does in the implementation presented in the ANSI K&amp;R book), but I thought I would ask to be sure.</p>
  
  <p>I guess this question applies to other similar functions such as gets().</p>
  
  <p>EDIT: I know that \0 is appended during "normal" circumstances, my question is targeted at EOF or error conditions. For example:</p>
  
  <pre><code>FILE *fp;
  char b[128];
  /* ... */
  if (feof(fp)) {
      /* is \0 appended after EACH of these calls? */
      fgets(b, 128, fp);
      fgets(b, 128, fp);
      fgets(b, 128, fp);
  }
  </code></pre>