strerror_r -- return string describing error number


#include <string.h>

char * strerror_r(int errnum, char * buf, size_t buflen);


In the source standard, strerror_r() is implemented as a macro causing it to behave as described in POSIX 1003.1-2008 (ISO/IEC 9945-2009), and is equivalent to the function __xpg_strerror_r(). If the macro is undefined, strerror_r() from the binary standard is used, with differences as described here.

The strerror_r() function shall return a pointer to the string corresponding to the error number errnum. The returned pointer may point within the buffer buf (at most buflen bytes).

Return Value

On success, strerror_r() shall return a pointer to the generated message string (determined by the setting of the LC_MESSAGES category in the current locale). Otherwise, strerror_r() shall return the string corresponding to "Unknown error".

See Also