Alternate Entry Name: _PERRO
B: perror(s);
/* C users see "expl c lib perror" */
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.
Copyright © 1996, Thinkage Ltd.