Item Value
Header filestring.h
Declarationchar *strerror(int errnum);
Returnreturns error message associated with the errnum.
Print an implementation-defined error message on the screen:
#include
#include
int main(void){
printf(strerror(10));
}
#include
#include
#include
int main ()
{
FILE * pFile;
pFile = fopen ("unexist.ent","r");
if (pFile == NULL)
printf ("Error opening file unexist.ent: %s\n",strerror(errno));
return 0;
}
Error opening file unexist.ent: No such file or directory (ENOENT)