title: How to detect empty lines while reading from istream object in C++?
body: <p>How can I detect if a line is empty?</p>
  
  <p>I have:</p>
  
  <pre><code>1
  2
  3
  4
  
  5
  </code></pre>
  
  <p>I'm reading this with istream r
  so:</p>
  
  <pre><code>int n;
  r &gt;&gt; n
  </code></pre>
  
  <p>I want to know when I reach the space between 4 and 5.
  I tried reading as char and using .peek() to detect \n but this detects the \n that goes after number 1 . The translation of the above input is: 1\n2\n3\n4\n\n5\n if I'm correct...</p>
  
  <p>Since I'm going to manipulate the ints I rather read them as ints than using getline and then converting to int...</p>