Print error message: how to use perror
#include <stdio.h> int main () { FILE *file; file=fopen ("my.ent", "rb"); if (file==NULL) perror ("An error has occurred"); else fclose (file); return 0; }