basic_ios::exceptions
Hangi özel durumlar akış tarafından atılan gösterir.
iostate exceptions( ) const;
void exceptions(
iostate _Newexcept
);
void exceptions(
io_state _Newexcept
);
Parametreler
- _Newexcept
İstisna istediğiniz bayraklar.
Dönüş Değeri
Şu an için akış için özel durum belirtilen bayraklar.
Notlar
İlk üye işlev saklı özel durum maskesi verir. İkinci üye işlev depoları _Except özel durum maskesi ve verir, önceki değeri saklı. Yeni bir özel durum maskesi saklama çağrısı gibi bir özel durum Not temizlemek( rdstate ).
Örnek
// basic_ios_exceptions.cpp
// compile with: /EHsc /GR
#include <iostream>
int main( )
{
using namespace std;
cout << cout.exceptions( ) << endl;
cout.exceptions( ios::eofbit );
cout << cout.exceptions( ) << endl;
try
{
cout.clear( ios::eofbit ); // Force eofbit on
}
catch ( exception &e )
{
cout.clear( );
cout << "Caught the exception." << endl;
cout << "Exception class: " << typeid(e).name() << endl;
cout << "Exception description: " << e.what() << endl;
}
}
Gereksinimler
Başlık: <ios>
Namespace: std