'\" te .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved .\" Copyright 1989 AT&T .TH perror 3C "12 Jul 2007" "SunOS 5.11" "Standard C Library Functions" .SH NAME perror, errno \- print system error messages .SH SYNOPSIS .LP .nf #include \fBvoid\fR \fBperror\fR(\fBconst char *\fR\fIs\fR) .fi .LP .nf #include int errno; .fi .SH DESCRIPTION .sp .LP The \fBperror()\fR function 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 \fIs\fR is printed, followed by a colon and a blank, followed by the message and a \fBNEWLINE\fR character. If \fIs\fR is a null pointer or points to a null string, the colon is not printed. The argument string should include the name of the program that incurred the error. The error number is taken from the external variable \fBerrno\fR, which is set when errors occur but not cleared when non-erroneous calls are made. See \fBIntro\fR(2). .sp .LP In the case of multithreaded applications, the \fB-mt\fR option must be specified on the command line at compilation time (see \fBthreads\fR(5)). When the \fB-mt\fR option is specified, \fBerrno\fR becomes a macro that enables each thread to have its own \fBerrno\fR. This \fBerrno\fR macro can be used on either side of the assignment as though it were a variable. .SH USAGE .sp .LP Messages printed from this function are in the native language specified by the \fBLC_MESSAGES\fR locale category. See \fBsetlocale\fR(3C). .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe _ StandardSee \fBstandards\fR(5). .TE .SH SEE ALSO .sp .LP \fBIntro\fR(2), \fBfmtmsg\fR(3C), \fBgettext\fR(3C), \fBsetlocale\fR(3C), \fBstrerror\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5), \fBthreads\fR(5)