PERROR - print error message to stderr.

(ANSI Standard)


#include <stdio.h>


const char *s;
points to a character string that will be printed as the first part of the error message. "perror" will print 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.


"perror" prints out an error message based on the current value of the external variable "errno". The value of "errno" is set by C 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.

See Also:

expl c lib errno

expl c lib strerror

Copyright © 1996, Thinkage Ltd.