The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


strerror - get error message string


#include <string.h>

char *strerror(int errnum);


The strerror() function maps the error number in errnum to a locale-dependent error message string and returns a pointer thereto. The string pointed to must not be modified by the program, but may be overwritten by a subsequent call to strerror() or perror().

The contents of the error message strings returned by strerror() should be determined by the setting of the LC_MESSAGES category in the current locale.

The implementation will behave as if no function defined in this specification calls strerror().

The strerror() function will not change the setting of errno if successful.

Because no return value is reserved to indicate an error, an application wishing to check for error situations should set errno to 0, then call strerror(), then check errno.

This interface need not be reentrant.


Upon successful completion, strerror() returns a pointer to the generated message string. On error errno may be set, but no return value is reserved to indicate an error.


The strerror() function may fail if:
The value of errnum is not a valid error number.








perror(), <string.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]