enum class
<system_error>

std::errc

enum class errc;
Generic error conditions
This enum class type defines the error conditions of the generic category.

The value of each label is the same as the value defined for the equivalent errno value.

errc labelerrno equivalent*
address_family_not_supportedEAFNOSUPPORT
address_in_useEADDRINUSE
address_not_availableEADDRNOTAVAIL
already_connectedEISCONN
argument_list_too_longE2BIG
argument_out_of_domainEDOM
bad_addressEFAULT
bad_file_descriptorEBADF
bad_messageEBADMSG
broken_pipeEPIPE
connection_abortedECONNABORTED
connection_already_in_progressEALREADY
connection_refusedECONNREFUSED
connection_resetECONNRESET
cross_device_linkEXDEV
destination_address_requiredEDESTADDRREQ
device_or_resource_busyEBUSY
directory_not_emptyENOTEMPTY
executable_format_errorENOEXEC
file_existsEEXIST
file_too_largeEFBIG
filename_too_longENAMETOOLONG
function_not_supportedENOSYS
host_unreachableEHOSTUNREACH
identifier_removedEIDRM
illegal_byte_sequenceEILSEQ
inappropriate_io_control_operationENOTTY
interruptedEINTR
invalid_argumentEINVAL
invalid_seekESPIPE
io_errorEIO
is_a_directoryEISDIR
message_sizeEMSGSIZE
network_downENETDOWN
network_resetENETRESET
network_unreachableENETUNREACH
no_buffer_spaceENOBUFS
no_child_processECHILD
no_linkENOLINK
no_lock_availableENOLOCK
no_messageENOMSG
no_message_availableENODATA
no_protocol_optionENOPROTOOPT
no_space_on_deviceENOSPC
no_stream_resourcesENOSR
no_such_deviceENODEV
no_such_device_or_addressENXIO
no_such_file_or_directoryENOENT
no_such_processESRCH
not_a_directoryENOTDIR
not_a_socketENOTSOCK
not_a_streamENOSTR
not_connectedENOTCONN
not_enough_memoryENOMEM
not_supportedENOTSUP
operation_canceledECANCELED
operation_in_progressEINPROGRESS
operation_not_permittedEPERM
operation_not_supportedEOPNOTSUPP
operation_would_blockEWOULDBLOCK
owner_deadEOWNERDEAD
permission_deniedEACCES
protocol_errorEPROTO
protocol_not_supportedEPROTONOSUPPORT
read_only_file_systemEROFS
resource_deadlock_would_occurEDEADLK
resource_unavailable_try_againEAGAIN
result_out_of_rangeERANGE
state_not_recoverableENOTRECOVERABLE
stream_timeoutETIME
text_file_busyETXTBSY
timed_outETIMEDOUT
too_many_files_openEMFILE
too_many_files_open_in_systemENFILE
too_many_linksEMLINK
too_many_symbolic_link_levelsELOOP
value_too_largeEOVERFLOW
wrong_protocol_typeEPROTOTYPE
* These are macro constants defined in header <cerrno>.

Notice that errc is defined as an enum class while the possible values of errno are macro definitions.

is_error_condition_enum is specialized for this type so its value is true.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// errc example
#include <iostream>       // std::cout
#include <system_error>   // std::error_condition, std::errc, std::generic_category
#include <cerrno>         // EEXIST

int main()
{
  // two ways of creating the same error_condition:
  std::error_condition foo (std::errc::file_exists);
  std::error_condition bar (EEXIST, std::generic_category() );

  if (foo == bar) std::cout << foo.message();

  return 0;
}

Possible output:
File exists


See also