std::io_errc
Материал из 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>
|
||
| enum class io_errc; |
(начиная с C++11) | |
Областью
std::io_errc перечисление определяет коды ошибок, сообщает потоки ввода / вывода в объекты std::ios_base::failure исключение. Только один код ошибки (std::io_errc::stream) требуется, хотя реализация может определять дополнительные коды ошибок. Поскольку соответствующие специализации STD :: is_error_code_enum предусмотрено, значения типа std::io_errc которые неявно преобразуются в std::error_code.Original:
The scoped enumeration
std::io_errc defines the error codes reported by I/O streams in std::ios_base::failure exception objects. Only one error code (std::io_errc::stream) is required, although the implementation may define additional error codes. Because the appropriate specialization of std::is_error_code_enum is provided, values of type std::io_errc are implicitly convertible to std::error_code.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: Enumeration constant The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Value |
stream
|
1 |
[править] Вспомогательные классы
| расширяет std::is_error_code_enum типа чертой для определения кодов IOStream ошибки Original: extends the type trait std::is_error_code_enum to identify iostream error codes The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (шаблон класса) | |
[править] Не являющиеся членами функций
| строит код IOStream ошибки Original: constructs an iostream error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
| строит error_condition IOStream Original: constructs an iostream error_condition The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
[править] Пример
#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"; if(e.code() == std::io_errc::stream) std::cout << "The error code is std::io_errc::stream\n"; } }
Вывод:
Caught an ios_base::failure. The error code is std::io_errc::stream
[править] См. также
| (C++11) |
проводит зависит от платформы код ошибки Original: holds a platform-dependent error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |
| (C++11) |
имеет портативный код ошибки Original: holds a portable error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) |
| Поток исключение 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. (public член класса std::ios_base)
| |