Syntax
#include <string.h> char *strerror(int errnum);Description
strerror maps the error number in errnum to an error message string.
strerror returns a pointer to the string. The contents of the error message string is determined by the setting of the LC_MESSAGES category in the current locale.
The value of errno may be set to:
EILSEQ
This example opens a file and prints a run-time error message if an error occurs.
#include <stdio.h>#include <string.h>
#include <errno.h>
#define FILENAME "strerror.dat"
int main(void)
{
   FILE *stream;
   if (NULL == (stream = fopen(FILENAME, "r")))
      printf(" %s \n", strerror(errno));
   return 0;
}
Related Information