errno

global variable used to return error values 

Global Variable


SYNOPSIS

#include <errno.h>

extern int errno;


DESCRIPTION

The errno variable is used by many functions to return error values. The value of errno is defined only after a call to a function for which it is explicitly stated to be set and until it is changed by the next function call. The value of errno should only be examined when it is indicated to be valid by a function's return value. Programs should obtain the definition of errno by the inclusion of <errno.h>. The practice of defining errno in a program as

extern int errno;

(without including <errno.h>) is unsupported.

It is unspecified whether errno is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access the actual object, or a program defines an identifier with the name errno, the behavior is undefined.

The symbolic values stored in errno are documented in the RETURN VALUES section on all relevant pages.


CONFORMANCE

UNIX 98, with exceptions.


PORTING ISSUES

Not all Win32 error codes can be represented as UNIX errno values. In these cases, errno is set to the negative of the Win32 error number. The perror() and strerror() functions take this into account, and produce the correct error message for both UNIX-defined and Win32-defined errors.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
perror(), strerror()

Miscellaneous:
h_errno, sys_errlist, sys_nerr


PTC MKS Toolkit 9.6 Documentation Build 9.