PERROR - output error message to standard error unit.

Alternate Entry Name: _PERRO

Usage:

B:
   perror(s);
/* C users see "expl c lib perror" */

Where:

s
points to a character string that will be printed as the first part of the error message. PERROR outputs this string first, followed by a colon and a blank, followed by the error message generated by STRERROR. The most helpful sort of string would be the name of the program or some similar identifier.

Description:

PERROR prints out an error message based on the current value of the external variable ERRNO. The value of ERRNO is set by some library functions when error conditions are encountered. Thus the message printed by PERROR reflects the last error encountered during a call to a library function. The function STRERROR obtains the text of the appropriate error message.

Note that there is a similar function .PERROR which call .STRERROR instead of STRERROR. In general, you should use .PERROR instead of PERROR, because the value of ERRNO doesn't already reflect the error that caused the posted message. For example, if the user presses BREAK between the time the error message is posted and the time you call PERROR, ERRNO changes to reflect the user interrupt rather than the original error. If you use .PERROR instead of PERROR, you get the posted message describing the original error.

See Also:

expl b lib strerror

expl b lib .perror

Copyright © 1996, Thinkage Ltd.