std::iostream_category
De cppreference.com.
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Défini dans l'en-tête <ios>
|
||
| const std::error_category& iostream_category(); |
(depuis C++11) | |
Obtient une référence à l'objet catégorie d'erreur statique des erreurs iostream. L'objet est nécessaire pour annuler la error_category::name() fonction virtuelle de retourner un pointeur sur la chaîne de "iostream". Il est utilisé pour identifier les codes d'erreur fournis dans les exceptions prévues std::ios_base::failure type .
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.
Sommaire |
[modifier] Paramètres
(Aucun)
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.
[modifier] Retourne la valeur
Une référence à l'objet statique de type à l'exécution indéterminée, dérivé de 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.
[modifier] Exceptions
[modifier] Exemple
#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" << "Error category: " << e.code().category().name() << '\n'; } }
Résultat :
Caught an ios_base::failure. Error category: iostream
[modifier] Voir aussi
| exception ruisseau 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. (classe membre publique de std::ios_base)
| |
| (C++11) |
les codes d'erreur IO cours d'eau 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) |