title: Why is the fgets function deprecated?
body: <p>From <a href="http://crasseux.com/books/ctutorial/fgets.html" rel="noreferrer">The GNU C Programming Tutorial</a>:</p>
  
  <blockquote>
    <p>The <code>fgets</code> ("file get string") function is similar to the gets
    function. This function is <em>deprecated</em> -- that means it is obsolete
    and it is strongly suggested you do not use it -- because it is
    dangerous. It is dangerous because if the input data contains a null
    character, you can't tell. Don't use <code>fgets</code> unless you know the data
    cannot contain a null. Don't use it to read files edited by the user
    because, if the user inserts a null character, you should either
    handle it properly or print a clear error message. Always use
    <code>getline</code> or <code>getdelim</code> instead of <code>fgets</code> if you can.</p>
  </blockquote>
  
  <p>I thought the <code>fgets</code> function stops when it encounters a <code>\0</code> or <code>\n</code>; why does this manual page suggest a null byte is "dangerous" when <code>fgets</code> should handle the input properly? Furthermore, what is the difference between <code>getline</code> and <code>fgets</code>, and is the <code>fgets</code> function truly considered <em>deprecated</em> in the <strong>C99</strong> or future C standards?</p>