title: Read string one char at a time until end of line or file
body: <p>So, I need to read several lines of numbers from <code>stdin</code> char-by-char; that is, after each char read I need to do something to it and only after that I can read another one; I also need to know when the line ends and another starts. Those numbers are newline-separated and I have no problem with that; but there is no <code>\n</code> after the last string, so I have a problem with determining when to stop reading the last line. I feel really stupid, but googling didn't help me at all. I assume it should be something like this:</p>
  
  <pre><code>char b;
  for (size_t i = 0; i!= N; ++i) {
      while (some_mysterious_condition) {
          std::cin &gt;&gt; b;
          //so on
      }
  </code></pre>
  
  <p>I can't figure out what condition I should put there. I've tried using <code>std::cin.get(b)</code>, but it seems to ignore newlines.</p>