std::io_errc

来自cppreference.com
< cpp | io

 
 
輸入/輸出庫
I / O操縱
C-風格的I / O
緩衝區
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(過時了)
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽象
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
文件I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
字元串I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
陣列的I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(過時了)
ostrstream(過時了)
strstream(過時了)
類型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Error類的介面
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::io_errc
Helper類
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
is_error_code_enum<std::io_errc>
輔助功能
Original:
Helper functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
make_error_code(std::io_errc)
make_error_condition(std::io_errc)
 
Defined in header <ios>
enum class io_errc;
(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
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.

目錄

[编辑] 會員常數

枚舉常量
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

[编辑] Helper類

擴展了的類型特徵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.

(函數)
構建的iostream error_condition
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";
    }
}

Output:

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.

(類) [edit]
(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.

(類) [edit]
流異常
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.

(公共成員類of std::ios_base [edit]