Compartir a través de


basic_ios::rdstate

Reads the state of bits for flags.

iostate rdstate( ) const;

Return Value

The stored stream state information.

Example

// basic_ios_rdstate.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>
using namespace std;

void TestFlags( ios& x ) 
{
   cout << ( x.rdstate( ) & ios::badbit ) << endl;
   cout << ( x.rdstate( ) & ios::failbit ) << endl;
   cout << ( x.rdstate( ) & ios::eofbit ) << endl;
   cout << endl;
}

int main( ) 
{
   fstream x( "c:\test.txt", ios::out );
   x.clear( );
   TestFlags( x );
   x.clear( ios::badbit | ios::failbit | ios::eofbit );
   TestFlags( x );
}
0
0
0

4
2
1

Requirements

Header: <ios>

Namespace: std

See Also

Reference

basic_ios Class

iostream Programming

iostreams Conventions

Other Resources

basic_ios Members