I want to release all open files and directories that my program opened during its execution. I want to do this because I have a very large program and it opens up a lot of files and directories that I cannot track. Is there any way to do this? means that I want to get a list of all open files and directories and close them when I exit.
I know the registration of exit handlers using the atexit () function. Is there anything you can do with it?
Edit: I have cygwin on windows. I want to do this because my software resources are not automatically released. I have a directory that is created and then opened with opendir (). After completing my program, when I try to delete this directory, it says: "can not delete used by another program." But when I finish explorer.exe and restart again, then only I can delete this directory.
The problem is that this happens unevenly. I can delete some directories and not delete some.
source share