Close the File and Try again. How to Programmatically closing the file handler when FOpen=NULL?

  • Thread starter Thread starter KeanHeng
  • Start date Start date
K

KeanHeng

Guest
LAdies and gentlemen


I need your help.


As per above... I face with this message from window.

"Close the File and Try again"

How to Programmatically closing the file handler when FOpen=NULL?

Assuming this case where I'm trying to simulate why FOpen becomes NULL


RETRY_OPEN:

FILE *fp = fopen(filename, csFileMode);

fp = NULL; // for simulation of real-world case
if (!fp)
{
CopyFile(filename, csBackupOriFile, false);
DeleteFile(filename);
goto RETRY_OPEN;
}


Thanks in advance!

Continue reading...
 
Back
Top