<errno.h>


Include the standard header <errno.h> to test the value stored in errno by certain library functions.


EDOM · EILSEQ · ERANGE · errno


Overview

At program startup, the value stored in errno is zero. Library functions store only values greater than zero. Any library function can alter the value stored, but only those cases where a library function is explicitly required to store a value are documented here.

To test whether a library function stores a value in errno, the program should store the value zero there immediately before it calls the library function.

    /* MACROS */
#define EDOM <#if expression>
#define EILSEQ <#if expression> [added with Amendment 1]
#define ERANGE <#if expression>
#define errno <int modifiable lvalue>

Beginning with C++11, the set of error code macros (such as EDOM, etc. above) is greatly increased for compatibility with Posix (EOTHER indicates a non-Posix error code):

#define E2BIG [argument list too long]
#define EACCES [permission denied]
#define EADDRINUSE [address in use]
#define EADDRNOTAVAIL [address not available]
#define EAFNOSUPPORT [address family not supported]
#define EAGAIN [resource unavailable try again]
#define EALREADY [connection already in progress]
#define EBADF [bad file descriptor]
#define EBADMSG [bad message]
#define EBUSY [device or resource busy]
#define ECANCELED [operation canceled]
#define ECHILD [no child process]
#define ECONNABORTED [connection aborted]
#define ECONNREFUSED [connection refused]
#define ECONNRESET [connection reset]
#define EDEADLK [resource deadlock would occur]
#define EDESTADDRREQ [destination address required]
#define EDOM [argument out of domain]
#define EEXIST [file exists]
#define EFAULT [bad address]
#define EFBIG [file too large]
#define EHOSTUNREACH [host unreachable]
#define EIDRM [identifier removed]
#define EILSEQ [illegal byte sequence]
#define EINPROGRESS [operation in progress]
#define EINTR [interrupted]
#define EINVAL [invalid argument]
#define EIO [io error]
#define EISCONN [already connected]
#define EISDIR [is a directory]
#define ELOOP [too many synbolic link levels]
#define EMFILE [too many files open]
#define EMLINK [too many links]
#define EMSGSIZE [message size]
#define ENAMETOOLONG [filename too long]
#define ENETDOWN [network down]
#define ENETRESET [network reset]
#define ENETUNREACH [network unreachable]
#define ENFILE [too many files open in system]
#define ENOBUFS [no buffer space]
#define ENODATA [no message available]
#define ENODEV [no such device]
#define ENOENT [no such file or directory]
#define ENOEXEC [executable format error]
#define ENOLCK [no lock available]
#define ENOLINK [no link]
#define ENOMEM [not enough memory]
#define ENOMSG [no message]
#define ENOPROTOOPT [no protocol option]
#define ENOSPC [no space on device]
#define ENOSR [no stream resources]
#define ENOSTR [not a stream]
#define ENOSYS [function not supported]
#define ENOTCONN [not connected]
#define ENOTDIR [not a directory]
#define ENOTEMPTY [directory not empty]
#define ENOTRECOVERABLE [state not recoverable]
#define ENOTSOCK [not a socket]
#define ENOTSUP [not supported]
#define ENOTTY [inappropriate io control operation]
#define ENXIO [no such device or address]
#define EOPNOTSUPP [operation not supported]
#define EOTHER [other]
#define EOVERFLOW [value too large]
#define EOWNERDEAD [owner dead]
#define EPERM [operation not permitted]
#define EPIPE [broken pipe]
#define EPROTO [protocol error]
#define EPROTONOSUPPORT [protocol not supported]
#define EPROTOTYPE [wrong protocol type]
#define ERANGE [result out of range]
#define EROFS [read only file system]
#define ESPIPE [invalid seek]
#define ESRCH [no such process]
#define ETIME [stream timeout]
#define ETIMEDOUT [timed out]
#define ETXTBSY [text file busy]
#define EWOULDBLOCK [operation would block]
#define EXDEV [cross device link]

An implementation can define additional macros in this standard header that you can test for equality with the value stored. All these additional macros have names that begin with E.

EDOM

#define EDOM <#if expression>

The macro yields the value stored in errno on a domain error.

EILSEQ

#define EILSEQ <#if expression> [added with Amendment 1]

The macro yields the value stored in errno on an invalid multibyte sequence.

ERANGE

#define ERANGE <#if expression>

The macro yields the value stored in errno on a range error.

errno

#define errno <int modifiable lvalue>

The macro designates an object that is assigned a value greater than zero on certain library errors.


See also the Table of Contents and the Index.

Copyright © 1992-2013 by P.J. Plauger and Jim Brodie. All rights reserved.