DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

perror(S)


perror -- system error messages

Syntax

cc . . . -lc

#include <stdio.h>

void perror (const char *s);

extern int errno;

Description

The perror function produces a language-dependent message on the standard error output, 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 new-line. (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, which is set when errors occur but not cleared when non-erroneous calls are made.

The contents of the error message strings are the same as those returned by the strerror(S) function with argument errno.

See also

Intro(S), strerror(S)

Standards conformance

errno is conformant with:

X/Open CAE Specification, System Interfaces and Headers, Issue 4, 1992 ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .

perror is conformant with:

X/Open CAE Specification, System Interfaces and Headers, Issue 4, 1992 ;
ANSI X3.159-1989 Programming Language -- C ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003