⟩ Explain what are the measures that can be adopted to avoid errors in File Processing?
Following are the measures that can be adopted to avoid errors in file processing-
ferror() function can be used to detect any error during file accessing.This function will return a zero when there is no error or vice-versa.
FILE *fptr
if(ferror(fptr)==0)
printf(“n The file is available for processing”);
else
printf(“n Error in accessing file”);
To verify whether a file exists in the disks,the following definitions will help.
if(fptr==NULL)
printf(“n No content or file does not exist”);