c++ - What does it mean by setting the failbit/badbit/eofbit? -


what mean "setting failbit" - can infer underlying code failbit set (it non-zero) before when error occurs - on passing input t value of failbit still remains same - why remains same before

    `     #include <iostream>     using namespace std;      int main()     {      int i;          if(cin.good())          {               cout<<"all good"<<endl;               cout<<"rdstate: "<<cin.rdstate()<<" failbit: ".                  <<cin.failbit<<endl;           }           cin>>i;            while(cin.fail())           {                cout<<"failed"<<endl;                cout<<"rdstate: "<<cin.rdstate()<<" failbit: ".                     <<cin.failbit<<endl;                break;            }        return 0;      } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -