.TH strerror() "" "" "String Function (libc)"
.PC "Translate an error number into a string"
.B "#include <string.h>"
\fBchar *strerror(\fIerror\^\fB)\fR
\fBint \fIerror\^\fB;\fR
.PP
.II "error message, return text of"
.II "text of error message, return"
.B strerror()
helps to generate an error message.
It takes the argument
.IR error ,
which presumably is an error code generated by an error condition
in a program,
and may return a pointer to the corresponding error message.
.PP
The error numbers recognized and the texts of the corresponding error messages
are set by \*(CO.
.SH "See Also"
.Xr "libc," libc
.Xr "perror()," perror
.Xr "string.h" string.h
.br
\*(AS, \(sc7.11.6.2
.SH Notes
.B strerror()
returns a pointer to a static array that may be overwritten
by a subsequent call to
.BR strerror() .
.PP
.B strerror()
differs from the related function
.B perror()
in the following ways:
.B strerror()
receives the error number through its argument
.IR error ,
whereas
.B perror()
reads the global constant
.BR errno .
Also,
.B strerror()
returns a pointer to the error message, whereas
.B perror()
writes the message directly into the standard error stream.
.PP
The error numbers recognized and the texts of the messages
associated with each error number
are set by \*(CO.
However,
.B strerror()
and
.B perror()
return the same error message when handed the same error number.
