在线文档教程
C++
应用 | Utilities

std::errc

性病:ERRC

Defined in header
enum class errc;(since C++11)

范围枚举std::errc定义与POSIX错误代码对应的可移植错误条件的值。

成员常数

ConstantExplanation
address_family_not_supportederror condition corresponding to POSIX code EAFNOSUPPORT
address_in_useerror condition corresponding to POSIX code EADDRINUSE
address_not_availableerror condition corresponding to POSIX code EADDRNOTAVAIL
already_connectederror condition corresponding to POSIX code EISCONN
argument_list_too_longerror condition corresponding to POSIX code E2BIG
argument_out_of_domainerror condition corresponding to POSIX code EDOM
bad_addresserror condition corresponding to POSIX code EFAULT
bad_file_descriptorerror condition corresponding to POSIX code EBADF
bad_messageerror condition corresponding to POSIX code EBADMSG
broken_pipeerror condition corresponding to POSIX code EPIPE
connection_abortederror condition corresponding to POSIX code ECONNABORTED
connection_already_in_progresserror condition corresponding to POSIX code EALREADY
connection_refusederror condition corresponding to POSIX code ECONNREFUSED
connection_reseterror condition corresponding to POSIX code ECONNRESET
cross_device_linkerror condition corresponding to POSIX code EXDEV
destination_address_requirederror condition corresponding to POSIX code EDESTADDRREQ
device_or_resource_busyerror condition corresponding to POSIX code EBUSY
directory_not_emptyerror condition corresponding to POSIX code ENOTEMPTY
executable_format_errorerror condition corresponding to POSIX code ENOEXEC
file_existserror condition corresponding to POSIX code EEXIST
file_too_largeerror condition corresponding to POSIX code EFBIG
filename_too_longerror condition corresponding to POSIX code ENAMETOOLONG
function_not_supportederror condition corresponding to POSIX code ENOSYS
host_unreachableerror condition corresponding to POSIX code EHOSTUNREACH
identifier_removederror condition corresponding to POSIX code EIDRM
illegal_byte_sequenceerror condition corresponding to POSIX code EILSEQ
inappropriate_io_control_operationerror condition corresponding to POSIX code ENOTTY
interruptederror condition corresponding to POSIX code EINTR
invalid_argumenterror condition corresponding to POSIX code EINVAL
invalid_seekerror condition corresponding to POSIX code ESPIPE
io_errorerror condition corresponding to POSIX code EIO
is_a_directoryerror condition corresponding to POSIX code EISDIR
message_sizeerror condition corresponding to POSIX code EMSGSIZE
network_downerror condition corresponding to POSIX code ENETDOWN
network_reseterror condition corresponding to POSIX code ENETRESET
network_unreachableerror condition corresponding to POSIX code ENETUNREACH
no_buffer_spaceerror condition corresponding to POSIX code ENOBUFS
no_child_processerror condition corresponding to POSIX code ECHILD
no_linkerror condition corresponding to POSIX code ENOLINK
no_lock_availableerror condition corresponding to POSIX code ENOLCK
no_message_availableerror condition corresponding to POSIX code ENODATA
no_messageerror condition corresponding to POSIX code ENOMSG
no_protocol_optionerror condition corresponding to POSIX code ENOPROTOOPT
no_space_on_deviceerror condition corresponding to POSIX code ENOSPC
no_stream_resourceserror condition corresponding to POSIX code ENOSR
no_such_device_or_addresserror condition corresponding to POSIX code ENXIO
no_such_deviceerror condition corresponding to POSIX code ENODEV
no_such_file_or_directoryerror condition corresponding to POSIX code ENOENT
no_such_processerror condition corresponding to POSIX code ESRCH
not_a_directoryerror condition corresponding to POSIX code ENOTDIR
not_a_socketerror condition corresponding to POSIX code ENOTSOCK
not_a_streamerror condition corresponding to POSIX code ENOSTR
not_connectederror condition corresponding to POSIX code ENOTCONN
not_enough_memoryerror condition corresponding to POSIX code ENOMEM
not_supportederror condition corresponding to POSIX code ENOTSUP
operation_cancelederror condition corresponding to POSIX code ECANCELED
operation_in_progresserror condition corresponding to POSIX code EINPROGRESS
operation_not_permittederror condition corresponding to POSIX code EPERM
operation_not_supportederror condition corresponding to POSIX code EOPNOTSUPP
operation_would_blockerror condition corresponding to POSIX code EWOULDBLOCK
owner_deaderror condition corresponding to POSIX code EOWNERDEAD
permission_deniederror condition corresponding to POSIX code EACCES
protocol_errorerror condition corresponding to POSIX code EPROTO
protocol_not_supportederror condition corresponding to POSIX code EPROTONOSUPPORT
read_only_file_systemerror condition corresponding to POSIX code EROFS
resource_deadlock_would_occurerror condition corresponding to POSIX code EDEADLK
resource_unavailable_try_againerror condition corresponding to POSIX code EAGAIN
result_out_of_rangeerror condition corresponding to POSIX code ERANGE
state_not_recoverableerror condition corresponding to POSIX code ENOTRECOVERABLE
stream_timeouterror condition corresponding to POSIX code ETIME
text_file_busyerror condition corresponding to POSIX code ETXTBSY
timed_outerror condition corresponding to POSIX code ETIMEDOUT
too_many_files_open_in_systemerror condition corresponding to POSIX code ENFILE
too_many_files_openerror condition corresponding to POSIX code EMFILE
too_many_linkserror condition corresponding to POSIX code EMLINK
too_many_symbolic_link_levelserror condition corresponding to POSIX code ELOOP
value_too_largeerror condition corresponding to POSIX code EOVERFLOW
wrong_protocol_typeerror condition corresponding to POSIX code EPROTOTYPE

非会员职能

make_error_code(std::errc) (C++11)constructs an std::errc error code (function)
make_error_condition(std::errc) (C++11)constructs an std::errc error condition (function)

帮助者类

is_error_condition_enum (C++11)extends the type trait std::is_error_condition_enum to identify the the std::errc values as error conditions (function template)

二次

#include <iostream> #include <system_error> #include <thread> int main() { try { std::thread().detach( // detaching a not-a-thread } 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

二次

另见

error_code (C++11)holds a platform-dependent error code (class)
error_condition (C++11)holds a portable error code (class)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/Error/ERRC