C Language and Libraries Help (clang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Error Variables
◄Up► ◄Contents► ◄Index► ◄Back►
─────Run-Time Library───────────────────────────────────────────────────────
Variable: _doserrno, errno, _sys_errlist, _sys_nerr
Include: <stdlib.h>, <errno.h>
Syntax: int _doserrno;
int errno;
char * _sys_errlist[ ];
int _sys_nerr;
The errno, _sys_errlist, and _sys_nerr variables are used by the
perror function to print error information, and are declared in
the include file STDLIB.H. When an error occurs in a system-level
call, the errno variable is set to an integer value to reflect
the type of error.
The perror function uses the errno value to look up the
corresponding error message in the _sys_errlist table. The value
of the _sys_nerr variable is defined as the number of elements in
the _sys_errlist array.
The following errno values are supported:
E2BIG ECHILD EINVAL ENOMEM
EACCES EDEADLOCK EMFILE ENOSPC
EAGAIN EDOM ENOENT ERANGE
EBADF EEXIST ENOEXEC EXDEV
The errno values on DOS are a subset of the values for errno on
XENIX systems. Therefore, the value assigned to errno in case of
error does not necessarily correspond to the actual error code
returned by a DOS system call. Instead, the actual DOS error
codes are mapped onto the perror values.
Use the _doserrno variable if you want to access the actual
operating-system error code. When an error occurs in a system
call, the _doserrno variable is assigned the actual error code
returned by the corresponding operating-system call.
The value of errno reflects the error value for the last call that
set errno. The errno value is not automatically cleared by later
successful calls. Thus, to obtain accurate results, you should
test for errors and print error messages, if desired, immediately
after a call.
In general, you should use _doserrno only for error detection in
operations involving input and output, since the errno values for
input and output errors have operating-system error-code
equivalents. Not all of the error values available for errno have
exact operating-system error-code equivalents, and some may have
no equivalents, causing the value of _doserrno to be undefined.
-♦-