C Standard Library - <errno.h>
Introduction
The errno.h header file of the C Standard Library defines the integer variable errno, which is set by system calls and indicates errors in certain library functions when an error event occurs. This macro expands to a modifiable lvalue of type int, so it can be read and modified by a program.
At program startup, errno is set to zero, and specific functions in the C Standard Library modify its value to some non-zero value to indicate certain types of errors. You can also modify its value or reset it to zero when appropriate.
The errno.h header file defines a series of macros representing different error codes, which should expand to integer constant expressions of type int.
Library Macros
The following table lists the macros defined in the errno.h header file:
Number | Macro & Description |
---|---|
1 | extern int errno <br>This macro, set by system calls, indicates what error occurred in certain library functions during an error event. |
2 | EDOM Domain Error <br>This macro represents a domain error, which occurs when the input parameter is outside the domain defined by mathematical functions, and errno is set to EDOM. |
3 | ERANGE Range Error <br>This macro represents a range error, which occurs when the input parameter is outside the range defined by mathematical functions, and errno is set to ERANGE. |