std::iostream_category
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> | ||
conststd::error_category& iostream_category(); | (dal C++11) | |
Ottiene un riferimento all'oggetto statico categoria degli errori di iostream. L'oggetto è necessario eseguire l'override della funzione virtuale error_category::name() per restituire un puntatore alla stringa "iostream". Viene utilizzato per identificare i codici di errore previsti nelle eccezioni di cui std::ios_base::failure tipo.
Original:
Obtains a reference to the static error category object for iostream errors. The object is required to override the virtual function error_category::name() to return a pointer to the string "iostream". It is used to identify error codes provided in the exceptions of type std::ios_base::failure.
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]Parametri
(Nessuno)
Original:
(none)
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.
[modifica]Valore di ritorno
Un riferimento all'oggetto statico del tipo di runtime non specificato, derivato da std::error_category.
Original:
A reference to the static object of unspecified runtime type, derived from std::error_category.
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.
[modifica]Eccezioni
[modifica]Esempio
#include <iostream>#include <fstream> int main(){std::ifstream f("doesn't exist");try{ f.exceptions(f.failbit);}catch(conststd::ios_base::failure& e){std::cout<<"Caught an ios_base::failure.\n"<<"Error category: "<< e.code().category().name()<<'\n';}}
Output:
Caught an ios_base::failure. Error category: iostream
[modifica]Vedi anche
flusso di eccezione Original: stream exception The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (membro pubblico of std::ios_base classe) | |
(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) |