I am using the two flags FILE_ATTRIBUTE_TEMPORARY and FILE_FLAG_DELETE_ON_CLOSE while creating temporary files in my C++ application.
According to this blog🕗 there shouldn't be any file being created on the disk:
It’s only temporary
Larry Osterman, April 19, 2004
To create a “temporary” file, you call CreateFile specifying
FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSEin the dwFlagsAndAttributes attribute. This combination of bits acts as a hint to the filesystem that the file data should never be flushed to disk. In other words, such a file can be created, written to, and read from without the system ever touching the disk.
But in my code the file is created and written to on disk (even for 1 KB data). Can someone confirm the exact functionality of these flags, and whether the files are created on disk or not?