Borland C++ reference

errno, _doserrno, sys_errlist, sys_nerr

raw OCR global variable

Enable perror to print error messages.

Defined in header <errno.h>

Syntax

extern int errno;
extern int _doserrno;
extern char  * sys_errlist[ ];
extern int sys_nerr;

Remarks

errno, sys_errlist, and sysjnerr are used by perror to print error messages when certain Hbrary routines fail to accomplish their appointed tasks. jioserrno is a variable that maps many DOS error codes to errno; however, perror does not use jioserrno directly.

jioserrno: When a DOS system call results in an error, jioserrno is set to the actual DOS error code, errno is a parallel error variable inherited from UNIX.

errno: 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 DOS error code, which is contained in jioserrno. Still other errors might occur that set only errno, not jioserrno.

sys_errlist: To provide more control over message formatting, the array of message strings is provided in sys_errlist. You can use errno as an index into the array to find the string corresponding to the error number. The string does not include any newline character.

sysjierr: This variable is defined as the number of error message strings in sys_errlist.

The following table gives mnemonics and their meanings for the values stored in sys_errlist.

MnemonicMeaning
E2BIGArg list too long
EACCESPermission denied
EBADFBad file number
ECONTRMemory blocks destroyed
ECURDIRAttempt to remove CurDir
EDOMDomain error
EEXISTFile already exists
EFAULTUnknown error
EINVACCInvalid access code
EINVALInvalid argument
EINVDATInvalid data
EINVDRVInvalid drive specified
EINVENVInvalid environment
EINVFMTInvalid format
EINVFNCInvalid function number
EINVMEMInvalid memory block address
EMFILEToo many open files
ENMFILENo more files
ENODEVNo such device
ENOENTNo such file or directory
ENOEXECExec format error
ENOFILENo such file or directory
ENOMEMNot enough memory
ENOPATHPath not found
ENOTSAMNot same device
ERANGEResult out of range
EXDEVCross-device link
EZEROError 0

The follow^ing list gives mnemonics for the actual DOS error codes to w^hich _doserrno can be set. (This value of _doserrno may or may not be mapped (through errno) to an equivalent error message string in si/s_errlist.

MnemonicDOS error code
E2BIGBad environ
EACCESAccess denied
EACCESBad access
EACCESIs current dir
EBADFBad handle
EFAULTReserved
EINVALBad data
EINVALBad function
EMHLEToo many open
ENOENTNo such file or directory
ENOEXECBad format
ENOMEMMcb destroyed
ENOMEMOut of memory
ENOMEMBad block
EXDEVBad drive
EXDEVNot same device

Refer to your DOS reference manual for more information about DOS error return codes.

Example

#include <errno.h>
#include <stdio.h>

extern char *sys_errlist [];

main ()
{
   int i = 0;

   while (sys_errlist[i++]  printf("%s\n", sys_errlist [i]
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.

Extraction notes

  • heading `errno, _closerrno, sys_errlist, sys_nerr` read as `errno, _doserrno, sys_errlist, sys_nerr`