定义于头文件
<system_error>
|
||
enum class errc;
|
(C++11 起) | |
有作用域枚举 std::errc
定义对应 POSIX 错误码的可移植错误条件。
目录 |
常量 | 解释 |
address_family_not_supported
|
对应 POSIX 码 EAFNOSUPPORT 的错误条件 |
address_in_use
|
对应 POSIX 码 EADDRINUSE 的错误条件 |
address_not_available
|
对应 POSIX 码 EADDRNOTAVAIL 的错误条件 |
already_connected
|
对应 POSIX 码 EISCONN 的错误条件 |
argument_list_too_long
|
对应 POSIX 码 E2BIG 的错误条件 |
argument_out_of_domain
|
对应 POSIX 码 EDOM 的错误条件 |
bad_address
|
对应 POSIX 码 EFAULT 的错误条件 |
bad_file_descriptor
|
对应 POSIX 码 EBADF 的错误条件 |
bad_message
|
对应 POSIX 码 EBADMSG 的错误条件 |
broken_pipe
|
对应 POSIX 码 EPIPE 的错误条件 |
connection_aborted
|
对应 POSIX 码 ECONNABORTED 的错误条件 |
connection_already_in_progress
|
对应 POSIX 码 EALREADY 的错误条件 |
connection_refused
|
对应 POSIX 码 ECONNREFUSED 的错误条件 |
connection_reset
|
对应 POSIX 码 ECONNRESET 的错误条件 |
cross_device_link
|
对应 POSIX 码 EXDEV 的错误条件 |
destination_address_required
|
对应 POSIX 码 EDESTADDRREQ 的错误条件 |
device_or_resource_busy
|
对应 POSIX 码 EBUSY 的错误条件 |
directory_not_empty
|
对应 POSIX 码 ENOTEMPTY 的错误条件 |
executable_format_error
|
对应 POSIX 码 ENOEXEC 的错误条件 |
file_exists
|
对应 POSIX 码 EEXIST 的错误条件 |
file_too_large
|
对应 POSIX 码 EFBIG 的错误条件 |
filename_too_long
|
对应 POSIX 码 ENAMETOOLONG 的错误条件 |
function_not_supported
|
对应 POSIX 码 ENOSYS 的错误条件 |
host_unreachable
|
对应 POSIX 码 EHOSTUNREACH 的错误条件 |
identifier_removed
|
对应 POSIX 码 EIDRM 的错误条件 |
illegal_byte_sequence
|
对应 POSIX 码 EILSEQ 的错误条件 |
inappropriate_io_control_operation
|
对应 POSIX 码 ENOTTY 的错误条件 |
interrupted
|
对应 POSIX 码 EINTR 的错误条件 |
invalid_argument
|
对应 POSIX 码 EINVAL 的错误条件 |
invalid_seek
|
对应 POSIX 码 ESPIPE 的错误条件 |
io_error
|
对应 POSIX 码 EIO 的错误条件 |
is_a_directory
|
对应 POSIX 码 EISDIR 的错误条件 |
message_size
|
对应 POSIX 码 EMSGSIZE 的错误条件 |
network_down
|
对应 POSIX 码 ENETDOWN 的错误条件 |
network_reset
|
对应 POSIX 码 ENETRESET 的错误条件 |
network_unreachable
|
对应 POSIX 码 ENETUNREACH 的错误条件 |
no_buffer_space
|
对应 POSIX 码 ENOBUFS 的错误条件 |
no_child_process
|
对应 POSIX 码 ECHILD 的错误条件 |
no_link
|
对应 POSIX 码 ENOLINK 的错误条件 |
no_lock_available
|
对应 POSIX 码 ENOLCK 的错误条件 |
no_message_available
|
对应 POSIX 码 ENODATA 的错误条件 |
no_message
|
对应 POSIX 码 ENOMSG 的错误条件 |
no_protocol_option
|
对应 POSIX 码 ENOPROTOOPT 的错误条件 |
no_space_on_device
|
对应 POSIX 码 ENOSPC 的错误条件 |
no_stream_resources
|
对应 POSIX 码 ENOSR 的错误条件 |
no_such_device_or_address
|
对应 POSIX 码 ENXIO 的错误条件 |
no_such_device
|
对应 POSIX 码 ENODEV 的错误条件 |
no_such_file_or_directory
|
对应 POSIX 码 ENOENT 的错误条件 |
no_such_process
|
对应 POSIX 码 ESRCH 的错误条件 |
not_a_directory
|
对应 POSIX 码 ENOTDIR 的错误条件 |
not_a_socket
|
对应 POSIX 码 ENOTSOCK 的错误条件 |
not_a_stream
|
对应 POSIX 码 ENOSTR 的错误条件 |
not_connected
|
对应 POSIX 码 ENOTCONN 的错误条件 |
not_enough_memory
|
对应 POSIX 码 ENOMEM 的错误条件 |
not_supported
|
对应 POSIX 码 ENOTSUP 的错误条件 |
operation_canceled
|
对应 POSIX 码 ECANCELED 的错误条件 |
operation_in_progress
|
对应 POSIX 码 EINPROGRESS 的错误条件 |
operation_not_permitted
|
对应 POSIX 码 EPERM 的错误条件 |
operation_not_supported
|
对应 POSIX 码 EOPNOTSUPP 的错误条件 |
operation_would_block
|
对应 POSIX 码 EWOULDBLOCK 的错误条件 |
owner_dead
|
对应 POSIX 码 EOWNERDEAD 的错误条件 |
permission_denied
|
对应 POSIX 码 EACCES 的错误条件 |
protocol_error
|
对应 POSIX 码 EPROTO 的错误条件 |
protocol_not_supported
|
对应 POSIX 码 EPROTONOSUPPORT 的错误条件 |
read_only_file_system
|
对应 POSIX 码 EROFS 的错误条件 |
resource_deadlock_would_occur
|
对应 POSIX 码 EDEADLK 的错误条件 |
resource_unavailable_try_again
|
对应 POSIX 码 EAGAIN 的错误条件 |
result_out_of_range
|
对应 POSIX 码 ERANGE 的错误条件 |
state_not_recoverable
|
对应 POSIX 码 ENOTRECOVERABLE 的错误条件 |
stream_timeout
|
对应 POSIX 码 ETIME 的错误条件 |
text_file_busy
|
对应 POSIX 码 ETXTBSY 的错误条件 |
timed_out
|
对应 POSIX 码 ETIMEDOUT 的错误条件 |
too_many_files_open_in_system
|
对应 POSIX 码 ENFILE 的错误条件 |
too_many_files_open
|
对应 POSIX 码 EMFILE 的错误条件 |
too_many_links
|
对应 POSIX 码 EMLINK 的错误条件 |
too_many_symbolic_link_levels
|
对应 POSIX 码 ELOOP 的错误条件 |
value_too_large
|
对应 POSIX 码 EOVERFLOW 的错误条件 |
wrong_protocol_type
|
对应 POSIX 码 EPROTOTYPE 的错误条件 |
(C++11)
|
构造一个 std::errc 错误码 (函数) |
(C++11)
|
构造一个 std::errc 错误条件 (函数) |
扩充 std::is_error_condition_enum 类型特性以鉴别 std::errc 值为 error_condition (函数模板) |
#include <iostream> #include <system_error> #include <thread> int main() { try { std::thread().detach(); // 脱附一个非线程 } catch (const std::system_error& e) { std::cout << "Caught a system_error\n"; if(e.code() == std::errc::invalid_argument) std::cout << "The error condition is std::errc::invalid_argument\n"; std::cout << "the error description is " << e.what() << '\n'; } }
输出:
Caught a system_error The error condition is std::errc::invalid_argument the error description is Invalid argument
(C++11)
|
保有依赖平台的错误码 (类) |
(C++11)
|
保有可移植的错误码 (类) |