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.
perror
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The perror function prints an error message to stderr. The
<string> argument is printed first, followed by a colon, the
system error message for the last library call that produced the
error, and a newline character. If <string> is a NULL pointer or a
pointer to a null string, perror prints only the system error
message.
The actual error number is stored in the variable errno (defined
in ERRNO.H). The system error messages are accessed through the
variable sys_errlist, which is an array of messages ordered by
error number. The perror function prints the appropriate error
message by using the errno value as an index to sys_errlist. The
value of the variable sys_nerr is defined as the maximum number of
elements in the sys_errlist array.
To produce accurate results, perror should be called immediately
after a library routine returns with an error. Otherwise, the
errno value may be overwritten by subsequent calls.
Under DOS and OS/2, some of the errno values listed in ERRNO.H are
not used. The perror function prints an empty string for any errno
value not used under DOS or OS/2.
Return Value
None.
-♦-