strerror(3C) DG/UX 4.30 strerror(3C)
NAME
strerror - Return a string corresponding to an error code.
SYNOPSIS
char *strerror(), *message;
int errno;
message = strerror(errno);
where errno is the error code of the message string.
DESCRIPTION
The strerror function returns a pointer to a string
corresponding to a given error code. The message is the
same text that perror(3c) would print (but without the
leading colon and blank and without a trailing newline).
RETURNS
A pointer to an error message string, or NULL if an error
occurred.
SEE ALSO
perror(3c).
EXAMPLE
The following program prints an error message corresponding
to the generic UNIX I/O message.
/* Program test for the strerror() function */
#include <errno.h>
#include <stdio.h>
char *strerror();
main() {
printf("Error message is: %s\n", strerror(EIO));
return 0;
}
A call to this program generates the output
Error message is: Error EIO(5) -- Error in input/ouput.
Licensed material--property of copyright holder(s) Page 1