问题描述
在我的C ++应用程序中创建临时文件时,我使用两个标志 FILE_ATTRIBUTE_TEMPORARY
和 FILE_FLAG_DELETE_ON_CLOSE
根据,不应该在磁盘上创建的任何文件。但在我的代码文件是创建和写入到磁盘(即使1 KB数据)。有人可以确认这些标志的确切功能,以及文件是否在磁盘上创建?
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. 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?
推荐答案
相同的链接,有引号:
将文件标记为临时将告诉系统它不需要在磁盘上,但它不会阻止它被放在那里。
Marking a file as temporary will tell the system it doesn't need to be on disk, but it doesn't prevent it from being put there, either.
这篇关于使用FILE_ATTRIBUTE_TEMPORARY和FILE_FLAG_DELETE_ON_CLOSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!