Udostępnij za pośrednictwem


basic_ios::rdstate

Odczytuje stan bity flagi.

iostate rdstate( ) const;

Wartość zwracana

Informacje o stanie przechowywanych strumienia.

Przykład

// 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 );
}
  

Wymagania

Nagłówek: <ios>

Obszar nazw: std

Zobacz też

Informacje

basic_ios Class

iostream Programowanie

iostreams Konwencji