std::ios_base::failure
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <ios> | ||
class failure; | ||
Il std::ios_base::failure classe definisce un oggetto eccezione che viene generata in caso di fallimento da parte delle funzioni di Input / Output biblioteca.
Original:
The class std::ios_base::failure defines an exception object that is thrown on failure by the functions in the Input/Output library.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica]Membri funzioni
costruisce l'oggetto eccezione Original: constructs the exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |
Inherited from std::system_error
Member functions
restituisce il codice di errore Original: returns error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
[virtuale] | restituisce stringa esplicativa Original: returns explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico virtuale) |
Inherited from std::runtime_error
Inherited from std::exception
Member functions
[virtuale] | distrugge l'oggetto eccezione Original: destructs the exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico virtuale) |
[virtuale] | restituisce una stringa esplicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico virtuale) |
[modifica]Esempio
#include <iostream>#include <fstream>int main(){std::ifstream f("doesn't exist");try{ f.exceptions(f.failbit);}catch(const std::ios_base::failure& e){std::cout<<"Caught an ios_base::failure.\n"<<"Explanatory string: "<< e.what()<<'\n'<<"Error code: "<< e.code()<<'\n';}}
Output:
Caught an ios_base::failure. Explanatory string: ios_base::clear: unspecified iostream_category error Error code: iostream:1
[modifica]Vedi anche
(C++11) | il flusso IO codici di errore Original: the IO stream error codes The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (enum) |