Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

strerror - Return error message text

&pagelevel(4)&pagelevel

Definition

#include <string.h>

char *strerror(int errnum);

strerror maps the error number passed in errnum to a message text that is language dependent, and returns a pointer to this string.

The returned message text can also contain inserts:

  • If the error number passed in the errnum parameter matches the current error number, inserts are taken into account and added to the error message text. The current error number is the one stored in the errno variable.

  • Otherwise a message text is returned without inserts, that matches the error number passed in errnum.

Return val.

Pointer to an internal C memory area

containing a string with the error message text.

Note

The area to which strerror points may not be modified by the program. It can be overwritten only by repeated strerror calls.

Example

#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(void)
{
     printf("Error message for EDOM: %s\n", strerror(EDOM));
     return 0;
}

See also

perror