std::ios_base::failure
Материал из 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. |
| Заголовочный файл <ios>
|
||
| class failure; |
||
Класс std::ios_base::failure определяет объект исключения, которое выбрасывается на невыполнение функций в библиотеки ввода / вывода.
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.
Содержание |
[править] Член функций
| строит объект исключения 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. (public функция-член) | |
Унаследован от std::system_error
Member functions
| возвращает код ошибки 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. (public функция-член std::system_error)
| |
| [virtual] |
возвращает пояснительной строкой 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 public std::system_error функция-член)
|
Унаследован от std::runtime_error
Унаследован от std::exception
Member functions
| [virtual] |
разрушает объект исключения 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 public std::exception функция-член)
|
| [virtual] |
возвращает пояснительной строкой 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 public std::exception функция-член)
|
[править] Пример
#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'; } }
Вывод:
Caught an ios_base::failure. Explanatory string: ios_base::clear: unspecified iostream_category error Error code: iostream:1
[править] См. также
| (C++11) |
IO коды поток ошибок 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. (перечисление) |
