The header file ERRNO.H defines several macros used to define and document
runtime errors. These macros are used in conjunction with the perror() function.
The ERRNO.H definitions include an external integer named errno. Many of the
C library functions assign a value to this variable if an error occurs during
function execution. The file ERRNO.H also defines a group of symbolic constants
for these errors, listed in Table below.
The symbolic error constants defined in ERRNO.H.
||Message and Meaning
||Argument list too long (list length exceeds 128 bytes).
||Permission denied (for example, trying to write to a file
opened for read only).
||Bad file descriptor.
||Math argument out of domain (an argument passed to a math
function was outside the allowable range).
||Too many open files.
||No such file or directory.
||Exec format error.
||Not enough core (for example, not enough memory to
execute the exec() function).
||Path not found.
||Result out of range (for example, result returned by a
math function is too large or too small for the return data type).
You can use errno two ways. Some functions signal, by means of their return
value, that an error has occurred. If this happens, you can test the value of
errno to determine the nature of the error and take appropriate action.
Otherwise, when you have no specific indication that an error occurred, you can
test errno. If it's nonzero, an error has occurred, and the specific value of
errno indicates the nature of the error. Be sure to reset errno to zero after
handling the error.