CFile and Power Loss Situations
Posted on 1998-07-24
Using the code below I put a breakpoint AFTER the Close(), and I then pull the power on the machine. When I reboot the file has been deleted ! - Is this done by ChkDsk on restart (which is executed when clean shutdown does not take place) ?, Is this a bug ?, and finally is there a way I can prevent the file from being deleted ?
Note : It also has this behaviour when executing a release .exe (i.e. it does not have to be running under MSDEV for this to happen).
char* pFileName = "d:\\nt\\1300\\ned.nt1.1300\\tcq\\PRC00516.001";
f.Open( pFileName, CFile::modeWrite | CFile::modeCreate );
f.Write( inp, sizeof(inp));