std::make_error_code(std::io_errc)
来自cppreference.com
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <ios> 中定义
|
||
std::error_code make_error_code( std::io_errc e ); |
(C++11 起) | |
如果由std::error_code构造一个对象的值类型std::io_errcreturn std::error_code(static_cast<int>(e), std::iostream_category())。这个函数被调用时std::error_code参数的构造函数std::io_errc.
原文:
Constructs an std::error_code object from a value of type std::io_errc as if by return std::error_code(static_cast<int>(e), std::iostream_category()). This function is called by the constructor of std::error_code when given an std::io_errc argument.
目录 |
[编辑] 参数
e | - | 错误代码号
|
[编辑] 返回值
值类型std::error_code保存错误代码编号
e
与错误类别"iostream"有关.原文:
A value of type std::error_code that holds the error code number from
e
associated with the error category "iostream".[编辑] 示例
#include <iostream> #include <system_error> int main() { std::error_code ec = std::make_error_code(std::io_errc::stream); std::cout << "Error code from io_errc::stream has category " << ec.category().name() << '\n'; }
输出:
Error code from io_errc::stream has category iostream
[编辑] 另请参阅
(C++11) |
从error_category创建了一个错误代码 原文: creates an error code from an error_category (函数) |
(C++11) |
持有与平台相关的错误代码 原文: holds a platform-dependent error code (类) |
(C++11) |
IO流的错误代码 (枚举) |