strerror()

NAME

perror(), strerror(), hstrerror(), - system error messages

SYNOPSIS

#include <stdio.h>

void perror (const char *string)
#include <string.h>
char * strerror (int errnum) char * hstrerror (int errnum)

DESCRIPTION

The strerror(3) and perror(3) functions look up the error message string corresponding to an error number.

The strerror(3) function accepts an error number argument errnum and returns a pointer to the corresponding message string.

The perror(3) function finds the error message corresponding to the current value of the global variable errno (see the errors(1) page) and writes it, followed by a newline, to the standard error file descriptor. If the argument string is non-NULL, it is prepended to the message string and separated from it by a colon and space (: .) If string is NULL, only the error message string is printed.

If errnum is not a recognized error number, the error message string will contain Unknown error: followed by the error number in decimal.

The hstrerror(3) call is a #define for strerror(3), provided for convenience in working with sockets.

SEE ALSO

errno(3)