title: Check if all values were successfully read from std::istream
body: <p>Let's say I have a file that has</p>
  
  <pre><code>100 text
  </code></pre>
  
  <p>If I try reading 2 numbers using ifstream, it would fail because <code>text</code> is not a number. Using fscanf I'll know it failed by checking its return code:</p>
  
  <pre><code>if (2 != fscanf(f, "%d %d", &amp;a, &amp;b))
      printf("failed");
  </code></pre>
  
  <p>But when using iostream instead of stdio, how do I know it failed?</p>