I am writing a desktop application under Windows in C++ MFC.
The application creates a index file, and writes information to it again and again.
If the application crashes, the next time the application starts it will delete the crashed index file and create a new one. I think in certain cases, the index file will be locked. It will be a disaster if I can not delete the locked index file.
How can I guarantee that I can delete the file and create a new one? I can make sure no other application opens the index file. It cannot be deleted just because of an application crash.
Can any one help?