### strerror -- Set Pointer to Runtime Error Message

Format

>     #include <string.h>
>     char *strerror(int errnum);

Language Level: ANSI, XPG4
strerror maps the error number in errnum to an error message string.

Return Value
strerror returns a pointer to the string. It does not use the program locale in any way.

On both OS/2 and Windows, the value of errno may be set to:

EILSEQ | An encoding error has occurred converting a multibyte character.
E2BIG | The output buffer is too small.

Example
This example opens a file and prints a runtime error message if an error occurs.

    #include <stdio.h>
    #include <string.h>
    #include <errno.h>

    #define FILENAME "myfile.dat"

    int main(void)
    {
       FILE *stream;

       if ((stream = fopen(FILENAME, "r")) == NULL)
          printf(" %s \n", strerror(errno));
       return 0;
    }

clearerr -- Reset Error Indicators
ferror -- Test for Read/Write Errors
perror -- Print Error Message
_sterror -- Set Pointer to System Error String
<string.h>