NAME
perror - Writes a message explaining a function error
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <errno.h>
void perror (
char *string );
extern char *sys_errlist[ ];
extern int sys_nerr;
PARAMETERS
string A parameter string that contains the name of the
program that caused the error. The ensuing printed
message contains this string, a colon, and an
explanation of the error.
DESCRIPTION
The perror() function writes a message on the standard error
output that describes the last error encountered by a func-
tion or library function. The error message includes the
string parameter string followed by a : (colon), a blank,
the message, and a newline character. The string parameter
string should include the name of the program that caused
the error. The error number is taken from errno, which is
set when an error occurs, but is not cleared when a success-
ful call is made.
Use errno as an index into the sys_errlist table to get the
message string without the newline character. The largest
message number provided in the table is sys_nerr. Be sure to
check sys_nerr because new error codes can be added to the
system before they are added to the table.
NOTES
AES Support Level:
Full use
RELATED INFORMATION
Functions: printf(3)
Acknowledgement and Disclaimer