Next: strlen, Previous: strerror, Up: Strings

### 5.21 `strerror_r`—convert error number to string and copy to buffer

Synopsis

         #include <string.h>
         char *strerror_r(int errnum, char *buffer, size_t n);

Description
`strerror_r` converts the error number errnum into a string and copies the result into the supplied buffer for a length up to n, including the NUL terminator. The value of errnum is usually a copy of `errno`. If `errnum` is not a known error number, the result is the empty string.

See `strerror` for how strings are mapped to `errnum`.

Returns
This function returns a pointer to a string. Your application must not modify that string.

Portability
`strerror_r` is a GNU extension.

`strerror_r` requires no supporting OS subroutines.