errno
Go Up to errno.h Index
Header File
errno.h
Syntax
extern int errno;
Description
errno is used by perror to print error messages when certain library routines fail to accomplish their appointed tasks.
When an error in a math or system call occurs, errno is set to indicate the type of error. Sometimes errno and _doserrno are equivalent. At other times, errno does not contain the actual operating system error code, which is contained in _doserrno. Still other errors might occur that set only errno, not _doserrno.
Example
#include <errno.h>
#include <stdio.h>
int main()
{
int i = 0;
// Global value _sys_nerr also defined in errno.h
while(i < _sys_nerr) {
printf("%s\n", _sys_errlist[i]);
i++;
}
return 0;
}