Detail - The CreateFile API call accepts several flags which affect how a file is created or opened. One of these flags, FILE_FLAG_DELETE_ON_CLOSE, specifies that the file will be deleted when the last handle to it is closed. A common activity for applications is to create temporary files. If the application terminates abnormally, these files may not be deleted, potentially wasting of disk space. But if CreateFile API is called with FILE_FLAG_DELETE_ON_CLOSE that deletes the file when all handles to it are closed, which will be perfect for temporary file scenarios.
Posted by - Sobhita Mercy E