std:: io_errc
From cppreference.net
|
헤더 파일에 정의됨
<ios>
|
||
|
enum
class
io_errc
{
stream
=
1
,
|
(C++11부터) | |
범위 지정 열거형
std::io_errc
는 I/O 스트림이
std::ios_base::failure
예외 객체에서 보고하는 오류 코드들을 정의합니다. 하나의 오류 코드(
std::io_errc::stream
)만이 필수적이지만, 구현체는 추가적인 오류 코드들을 정의할 수 있습니다.
std::is_error_code_enum
의 적절한 특수화가 제공되기 때문에,
std::io_errc
타입의 값들은
std::error_code
로 암시적으로 변환 가능합니다.
목차 |
멤버 상수
| 열거형 상수 | 값 |
stream
|
1 |
비멤버 함수
|
(C++11)
|
iostream 오류 코드를 생성합니다
(함수) |
|
iostream 오류 조건을 생성합니다
(함수) |
헬퍼 클래스
|
타입 특질
std::is_error_code_enum
을 확장하여 iostream 에러 코드를 식별함
(클래스 템플릿 특수화) |
예제
이 코드 실행
#include <fstream> #include <iostream> 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)
|
플랫폼 종속 에러 코드를 보유
(클래스) |
|
(C++11)
|
이식 가능한 에러 코드를 보유
(클래스) |
|
스트림 예외
(
std::ios_base
의
public 멤버 클래스)
|