File Errors :

Error During File Processing :

When an error encountered during file processing, the program execution will be terminated and error messages will be displayed. Following measures may be adopted to identify of avoid errors during file processing :

  • ferror() function can be used to detect any error during file accessing.
    FILE *fptr;
    if(ferror(fptr)==0)
    printf("\n The file is available for processing.");
    else
    printf("\n Error in accessing the file!");

  • To verify whether a file exists in the disk, the following definition will help :
    if(fptr == NULL)
    printf("\n No content or file does not exist");

  • When data in a file may be exhausted, end of file condition will be encountered. Use the following definition to display end of file condition :
    if(feof(fptr) == EOF)
    printf("\n End of file is reached");

    Note : That EOF is macro which specifies the end of file condition.

Entering an invalid file name or trying to write data to a write protected disk are some of the other reasons for errors during file processing.


Next Update

Loading...

Currently we improved our website User Interface and other contents. Our next update is adding video tutorials on this site so, We create a new YouTube channel, our YouTube channel name is CodeX.

We need some time for make video tutorials (CodeX) so, stay with us and keep supporting and you know already we make a Collaboration with HackIsOn YouTube channel long time ago So, please Subscribe Our Channels