Error opening file unexist.ent: No such file or directory.
In this case, strerror(errno) is the string version of the error.
1 2 3 4 5 6 7 8 9 10 11 12 13
/* perror example */
#include <stdio.h>
int main ()
{
FILE * pFile;
pFile=fopen ("unexist.ent","rb");
if (pFile==NULL)
perror ("The following error occurred");
else
fclose (pFile);
return 0;
}