문제

Although I have read a few previously answered questions regarding a similar issue, I am not yet clear on how to go ahead. This is the scenario:

I need to delete a few temporary files, but then they are not getting deleted. While debugging i realized that even manually trying to delete the files doesn't delete them. Hence I concluded that some file pointer has not been closed yet preventing me from deleting the file.

But then these file pointers are being used in parts of the code that are not accessible to me. This leaves me with only one solution (maybe), to check if a file pointer is open and delete it.

or is there any other way to handle the situation??

도움이 되었습니까?

해결책

If you're using Windows OS you can use MoveFileEx function.
This allows you do mark a file for deletion after reboot.

MoveFileEx(lpExistingFileName, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top