I use the two flags FILE_ATTRIBUTE_TEMPORARY and FILE_FLAG_DELETE_ON_CLOSE when creating temporary files in my C ++ application.
According to this blog, there should not be any files on the disk :
This is only temporary.
Larry Osterman, April 19, 2004
To create a "temporary" file, you call CreateFile, specifying FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE in dwFlagsAndAttributes attribute. This combination of bits serves as a hint to the file system that file data should never be written to disk. In other words, such a file can be created, written and read without the system ever touching the disk.
But in my code, the file is created and written to disk (even for 1 KB data). Can someone confirm the exact functionality of these flags, and are the files created on the disk or not?
source share