Platform SDK: Files and I/O |
To use operating system resources efficiently, an application should close files when they are no longer needed by using the CloseHandle function. If a file is open when an application terminates, the system closes it automatically.
The DeleteFile function can be used to delete a file. The file must, however, be closed before any attempt to delete it will succeed.