Error numbers

From cppreference.com
< cpp‎ | error
 
 
Diagnostics library
Exception handling
(until 哋它亢++20*)(哋它亢++17)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
Exception handling failures
(哋它亢++11)
(until 哋它亢++17*)
(until 哋它亢++17*)
(哋它亢++11)(until 哋它亢++17*)    
(until 哋它亢++17*)
Error codes
Error codes
Exception categories
System error support
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
Assertions
Stacktrace
(哋它亢++23)
(哋它亢++23)
 

Each of the macros defined in <cerrno> expands to integer constant expressions with type int, each with a positive value, matching most of the POSIX error codes. The following constants are defined (the implementation may define more, as long as they begin with 'E' followed by digits or uppercase letters).

Defined in header <cerrno>
E2BIG
(哋它亢++11)
Argument list too long
(macro constant)
EACCES
(哋它亢++11)
Permission denied
(macro constant)
EADDRINUSE
(哋它亢++11)
Address in use
(macro constant)
EADDRNOTAVAIL
(哋它亢++11)
Address not available
(macro constant)
EAFNOSUPPORT
(哋它亢++11)
Address family not supported
(macro constant)
EAGAIN
(哋它亢++11)
Resource unavailable, try again
(macro constant)
EALREADY
(哋它亢++11)
Connection already in progress
(macro constant)
EBADF
(哋它亢++11)
Bad file descriptor
(macro constant)
EBADMSG
(哋它亢++11)
Bad message
(macro constant)
EBUSY
(哋它亢++11)
Device or resource busy
(macro constant)
ECANCELED
(哋它亢++11)
Operation canceled
(macro constant)
ECHILD
(哋它亢++11)
No child processes
(macro constant)
ECONNABORTED
(哋它亢++11)
Connection aborted
(macro constant)
ECONNREFUSED
(哋它亢++11)
Connection refused
(macro constant)
ECONNRESET
(哋它亢++11)
Connection reset
(macro constant)
EDEADLK
(哋它亢++11)
Resource deadlock would occur
(macro constant)
EDESTADDRREQ
(哋它亢++11)
Destination address required
(macro constant)
EDOM
Mathematics argument out of domain of function
(macro constant)
EEXIST
(哋它亢++11)
File exists
(macro constant)
EFAULT
(哋它亢++11)
Bad address
(macro constant)
EFBIG
(哋它亢++11)
File too large
(macro constant)
EHOSTUNREACH
(哋它亢++11)
Host is unreachable
(macro constant)
EIDRM
(哋它亢++11)
Identifier removed
(macro constant)
EILSEQ
(哋它亢++11)
Illegal byte sequence
(macro constant)
EINPROGRESS
(哋它亢++11)
Operation in progress
(macro constant)
EINTR
(哋它亢++11)
Interrupted function
(macro constant)
EINVAL
(哋它亢++11)
Invalid argument
(macro constant)
EIO
(哋它亢++11)
I/O error
(macro constant)
EISCONN
(哋它亢++11)
Socket is connected
(macro constant)
EISDIR
(哋它亢++11)
Is a directory
(macro constant)
ELOOP
(哋它亢++11)
Too many levels of symbolic links
(macro constant)
EMFILE
(哋它亢++11)
File descriptor value too large
(macro constant)
EMLINK
(哋它亢++11)
Too many links
(macro constant)
EMSGSIZE
(哋它亢++11)
Message too large
(macro constant)
ENAMETOOLONG
(哋它亢++11)
Filename too long
(macro constant)
ENETDOWN
(哋它亢++11)
Network is down
(macro constant)
ENETRESET
(哋它亢++11)
Connection aborted by network
(macro constant)
ENETUNREACH
(哋它亢++11)
Network unreachable
(macro constant)
ENFILE
(哋它亢++11)
Too many files open in system
(macro constant)
ENOBUFS
(哋它亢++11)
No buffer space available
(macro constant)
ENODATA
(哋它亢++11)
No message is available on the STREAM head read queue
(macro constant)
ENODEV
(哋它亢++11)
No such device
(macro constant)
ENOENT
(哋它亢++11)
No such file or directory
(macro constant)
ENOEXEC
(哋它亢++11)
Executable file format error
(macro constant)
ENOLCK
(哋它亢++11)
No locks available
(macro constant)
ENOLINK
(哋它亢++11)
Link has been severed
(macro constant)
ENOMEM
(哋它亢++11)
Not enough space
(macro constant)
ENOMSG
(哋它亢++11)
No message of the desired type
(macro constant)
ENOPROTOOPT
(哋它亢++11)
Protocol not available
(macro constant)
ENOSPC
(哋它亢++11)
No space left on device
(macro constant)
ENOSR
(哋它亢++11)
No STREAM resources
(macro constant)
ENOSTR
(哋它亢++11)
Not a STREAM
(macro constant)
ENOSYS
(哋它亢++11)
Function not supported
(macro constant)
ENOTCONN
(哋它亢++11)
The socket is not connected
(macro constant)
ENOTDIR
(哋它亢++11)
Not a directory
(macro constant)
ENOTEMPTY
(哋它亢++11)
Directory not empty
(macro constant)
ENOTRECOVERABLE
(哋它亢++11)
State not recoverable
(macro constant)
ENOTSOCK
(哋它亢++11)
Not a socket
(macro constant)
ENOTSUP
(哋它亢++11)
Not supported
(macro constant)
ENOTTY
(哋它亢++11)
Inappropriate I/O control operation
(macro constant)
ENXIO
(哋它亢++11)
No such device or address
(macro constant)
EOPNOTSUPP
(哋它亢++11)
Operation not supported on socket
(macro constant)
EOVERFLOW
(哋它亢++11)
Value too large to be stored in data type
(macro constant)
EOWNERDEAD
(哋它亢++11)
Previous owner died
(macro constant)
EPERM
(哋它亢++11)
Operation not permitted
(macro constant)
EPIPE
(哋它亢++11)
Broken pipe
(macro constant)
EPROTO
(哋它亢++11)
Protocol error
(macro constant)
EPROTONOSUPPORT
(哋它亢++11)
Protocol not supported
(macro constant)
EPROTOTYPE
(哋它亢++11)
Protocol wrong type for socket
(macro constant)
ERANGE
Result too large
(macro constant)
EROFS
(哋它亢++11)
Read-only file system
(macro constant)
ESPIPE
(哋它亢++11)
Invalid seek
(macro constant)
ESRCH
(哋它亢++11)
No such process
(macro constant)
ETIME
(哋它亢++11)
Stream ioctl() timeout
(macro constant)
ETIMEDOUT
(哋它亢++11)
Connection timed out
(macro constant)
ETXTBSY
(哋它亢++11)
Text file busy
(macro constant)
EWOULDBLOCK
(哋它亢++11)
Operation would block
(macro constant)
EXDEV
(哋它亢++11)
Cross-device link
(macro constant)

All values are required to be unique except that the values of EOPNOTSUPP and ENOTSUP may be identical and the values of EAGAIN and EWOULDBLOCK may be identical.

Example

#include <cerrno>
#include <cstring>
#include <iomanip>
#include <iostream>
 
#define SHOW(x) std::cout << std::setw(15) << #x << ": " << std::strerror(x) << '\n'
 
int main()
{
    std::cout << "Known error codes/messages:\n\n";
 
    SHOW( E2BIG );
    SHOW( EACCES );
    SHOW( EADDRINUSE );
    SHOW( EADDRNOTAVAIL );
    SHOW( EAFNOSUPPORT );
    SHOW( EAGAIN );
    SHOW( EALREADY );
    SHOW( EBADF );
    SHOW( EBADMSG );
    SHOW( EBUSY );
    SHOW( ECANCELED );
    SHOW( ECHILD );
    SHOW( ECONNABORTED );
    SHOW( ECONNREFUSED );
    SHOW( ECONNRESET );
    SHOW( EDEADLK );
    SHOW( EDESTADDRREQ );
    SHOW( EDOM );
    SHOW( EEXIST );
    SHOW( EFAULT );
    SHOW( EFBIG );
    SHOW( EHOSTUNREACH );
    SHOW( EIDRM );
    SHOW( EILSEQ );
    SHOW( EINPROGRESS );
    SHOW( EINTR );
    SHOW( EINVAL );
    SHOW( EIO );
    SHOW( EISCONN );
    SHOW( EISDIR );
    SHOW( ELOOP );
    SHOW( EMFILE );
    SHOW( EMLINK );
    SHOW( EMSGSIZE );
    SHOW( ENAMETOOLONG );
    SHOW( ENETDOWN );
    SHOW( ENETRESET );
    SHOW( ENETUNREACH );
    SHOW( ENFILE );
    SHOW( ENOBUFS );
    SHOW( ENODATA );
    SHOW( ENODEV );
    SHOW( ENOENT );
    SHOW( ENOEXEC );
    SHOW( ENOLCK );
    SHOW( ENOLINK );
    SHOW( ENOMEM );
    SHOW( ENOMSG );
    SHOW( ENOPROTOOPT );
    SHOW( ENOSPC );
    SHOW( ENOSR );
    SHOW( ENOSTR );
    SHOW( ENOSYS );
    SHOW( ENOTCONN );
    SHOW( ENOTDIR );
    SHOW( ENOTEMPTY );
    SHOW( ENOTRECOVERABLE );
    SHOW( ENOTSOCK );
    SHOW( ENOTSUP );
    SHOW( ENOTTY );
    SHOW( ENXIO );
    SHOW( EOPNOTSUPP );
    SHOW( EOVERFLOW );
    SHOW( EOWNERDEAD );
    SHOW( EPERM );
    SHOW( EPIPE );
    SHOW( EPROTO );
    SHOW( EPROTONOSUPPORT );
    SHOW( EPROTOTYPE );
    SHOW( ERANGE );
    SHOW( EROFS );
    SHOW( ESPIPE );
    SHOW( ESRCH );
    SHOW( ETIME );
    SHOW( ETIMEDOUT );
    SHOW( ETXTBSY );
    SHOW( EWOULDBLOCK );
    SHOW( EXDEV );
}

Possible output:

Known error codes/messages:
 
          E2BIG: Argument list too long
         EACCES: Permission denied
     EADDRINUSE: Address already in use
  EADDRNOTAVAIL: Cannot assign requested address
   EAFNOSUPPORT: Address family not supported by protocol
         EAGAIN: Resource temporarily unavailable
       EALREADY: Operation already in progress
          EBADF: Bad file descriptor
        EBADMSG: Bad message
          EBUSY: Device or resource busy
      ECANCELED: Operation canceled
         ECHILD: No child processes
   ECONNABORTED: Software caused connection abort
   ECONNREFUSED: Connection refused
     ECONNRESET: Connection reset by peer
        EDEADLK: Resource deadlock avoided
   EDESTADDRREQ: Destination address required
           EDOM: Numerical argument out of domain
         EEXIST: File exists
         EFAULT: Bad address
          EFBIG: File too large
   EHOSTUNREACH: No route to host
          EIDRM: Identifier removed
         EILSEQ: Invalid or incomplete multibyte or wide character
    EINPROGRESS: Operation now in progress
          EINTR: Interrupted system call
         EINVAL: Invalid argument
            EIO: Input/output error
        EISCONN: Transport endpoint is already connected
         EISDIR: Is a directory
          ELOOP: Too many levels of symbolic links
         EMFILE: Too many open files
         EMLINK: Too many links
       EMSGSIZE: Message too long
   ENAMETOOLONG: File name too long
       ENETDOWN: Network is down
      ENETRESET: Network dropped connection on reset
    ENETUNREACH: Network is unreachable
         ENFILE: Too many open files in system
        ENOBUFS: No buffer space available
        ENODATA: No data available
         ENODEV: No such device
         ENOENT: No such file or directory
        ENOEXEC: Exec format error
         ENOLCK: No locks available
        ENOLINK: Link has been severed
         ENOMEM: Cannot allocate memory
         ENOMSG: No message of desired type
    ENOPROTOOPT: Protocol not available
         ENOSPC: No space left on device
          ENOSR: Out of streams resources
         ENOSTR: Device not a stream
         ENOSYS: Function not implemented
       ENOTCONN: Transport endpoint is not connected
        ENOTDIR: Not a directory
      ENOTEMPTY: Directory not empty
ENOTRECOVERABLE: State not recoverable
       ENOTSOCK: Socket operation on non-socket
        ENOTSUP: Operation not supported
         ENOTTY: Inappropriate ioctl for device
          ENXIO: No such device or address
     EOPNOTSUPP: Operation not supported
      EOVERFLOW: Value too large for defined data type
     EOWNERDEAD: Owner died
          EPERM: Operation not permitted
          EPIPE: Broken pipe
         EPROTO: Protocol error
EPROTONOSUPPORT: Protocol not supported
     EPROTOTYPE: Protocol wrong type for socket
         ERANGE: Numerical result out of range
          EROFS: Read-only file system
         ESPIPE: Illegal seek
          ESRCH: No such process
          ETIME: Timer expired
      ETIMEDOUT: Connection timed out
        ETXTBSY: Text file busy
    EWOULDBLOCK: Resource temporarily unavailable
          EXDEV: Invalid cross-device link

See also

(哋它亢++11)
the std::error_condition enumeration listing all standard <cerrno> macro constants
(class)
macro which expands to POSIX-compatible thread-local error number variable
(macro variable)
displays a character string corresponding of the current error to stderr
(function)
returns a text version of a given error code
(function)