[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    perror(3C) manual page Table of Contents

Name

perror, errno - print system error messages

Synopsis

#include <stdio.h>
void perror(const char *s);

#include <errno.h>
int errno;

MT-Level

MT-Safe

Description

perror() produces a message on the standard error output (file descriptor 2), describing the last error encountered during a call to a system or library function. The argument string s is printed first, then a colon and a blank, then the message and a newline. (However, if s is a null pointer or points to a null string, the colon is not printed.) To be of most use, the argument string should include the name of the program that incurred the error. The error number is taken from the external variable errno, (see intro(2) ), which is set when errors occur but not cleared when non-erroneous calls are made.

See Also

intro(2) , fmtmsg(3C) , gettext(3I) , setlocale(3C) , strerror(3C)

Notes

If the application is linked with -lintl, then messages printed from this function are in the native language specified by the LC_MESSAGES locale category; see setlocale(3C) .


Table of Contents