title: what does rdstate() return value means?
body: <pre><code>istream&amp; Read(istream &amp;is)
  {
      std::string buf;
      while (is &gt;&gt; buf)       
      {   
          cout &lt;&lt; is.eofbit &lt;&lt; " " &lt;&lt; is.failbit &lt;&lt; " " &lt;&lt; is.badbit &lt;&lt; endl;
          cout &lt;&lt; is.rdstate() &lt;&lt; endl;
          cout &lt;&lt; buf &lt;&lt; endl;
      }
      cout &lt;&lt; is.eofbit &lt;&lt; " " &lt;&lt; is.failbit &lt;&lt; " " &lt;&lt; is.badbit &lt;&lt; endl;
      cout &lt;&lt; is.rdstate() &lt;&lt; endl;
      is.clear();
      cout &lt;&lt; is.eofbit &lt;&lt; " " &lt;&lt; is.failbit &lt;&lt; " " &lt;&lt; is.badbit &lt;&lt; endl;
      cout &lt;&lt; is.rdstate() &lt;&lt; endl;
      return is;
  }
  </code></pre>
  
  <p>If I input normal characters like "test",the output is <code>1 2 4 0</code>.<br>
  Then I type CTRL+Z (windows),the output is <code>1 2 4 3</code> <code>1 2 4 0</code>.  </p>
  
  <p>Question :
  1. what does <code>rdstate()</code> return value means? (Why does it output 3,not 2? not 1?) </p>
  
  <ol start="2">
  <li>Why did not <code>is.eofbit</code>and <code>is.failbit</code> change after I typed CTRL+Z ?  (As <em>C++ Primer 5th Editon</em> says,Reaching end-of-file sets both eofbit and failbit )  </li>
  </ol>