basic_ios::rdstate
讀取位元狀態旗標。
iostate rdstate( ) const;
傳回值
儲存的資料流狀態資訊。
範例
// 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 );
}
需求
標題: <ios>
命名空間: std