C - fopen invalid file
When fopen
fails, it returns NULL
and sets errno
to indicate the type of error.
Check the return value, and if it's NULL
check errno
. You can use functions like perror
or strerror
to display simple messages about those errors.
in your param list:
FILE pFile ;
then:
pFile = fopen ("myfile.txt","r");
if (pFile == NULL)
printf("No Such File !! ");