Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

printf, fprintf, sprintf, NLprintf, NLfprintf, NLsprintf, wsprintf



PERROR(3,L)                 AIX Technical Reference                 PERROR(3,L)



-------------------------------------------------------------------------------
perror



PURPOSE

Writes a message explaining a system call error.

LIBRARY

Standard C Library (libc.a)

SYNTAX



                void perror (s)             extern int errno;
                char *s;                    extern char *sys_errlist [ ];
                                            extern int sys_nerr;



DESCRIPTION

The perror subroutine writes a message on the standard error output that
describes the last error encountered by a system call or library subroutine.
The error message includes the parameter string s followed by a ":" (colon), a
blank, the message, and a new-line character.  To be of the most use, the
parameter string s should include the name of the program that caused the
error.  The error number is taken from the external variable errno, which is
set when an error occurs, but is not cleared when a successful call is made.

To simplify various message formats, the array of message strings sys_errlist
is provided.  Use errno as an index into this table to get the message string
without the new-line character.  The largest message number provided in the
table is sys_nerr.  Be sure to check sys_nerr because new error codes may be
added to the system before they are added to the table.

RELATED INFORMATION

In this book:  "printf, fprintf, sprintf, NLprintf, NLfprintf, NLsprintf,
wsprintf."












Processed November 7, 1990        PERROR(3,L)                                 1



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026