title: read() from stdin doesn't ignore newline
body: <p>I am using the following conditional statement to read from standard input.</p>
  
  <pre><code>if ((n = read(0,buf,sizeof(buf))) != 0)
  </code></pre>
  
  <p>When inputting data from standard input, generally the user presses enter when done. But <code>read()</code> considers '\n' as input too in which case <code>n = 1</code> and the conditional doesn't evaluate to false. Is there a way to make the conditional evaluate to false when the user presses enter (without entering anything) on standard input apart from checking the contents of buf. Is there any other function other than <code>read()</code> that I might use for this purpose?? </p>
  
  <p>For that matter, what can be a way for read to determine end of input when the input comes from standard input (stdin)?</p>