std::ios_base::failure
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. |
Defined in header <ios>
|
||
class failure; |
||
El std::ios_base::failure clase define un objeto de excepción que se produce en caso de fallo de las funciones de la entrada / salida de la 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.
Contenido |
[editar] Las funciones miembro
construye el objeto de excepción 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. (miembro público función) |
Inherited from std::system_error
Member functions
devuelve el código de error 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. (miembro público of std::system_error función)
| |
[virtual] |
devuelve una cadena explicativa 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. (Virtual Member público of std::system_error función)
|
Inherited from std::runtime_error
Inherited from std::exception
Member functions
[virtual] |
destructs el objeto de excepción 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. (Virtual Member público of std::exception función)
|
[virtual] |
devuelve una cadena explicativa 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. (Virtual Member público of std::exception función)
|
[editar] Ejemplo
#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
[editar] Ver también
(C++11) |
los códigos IO secuencia de error 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) |