本文介绍了使用FILE_ATTRIBUTE_TEMPORARY和FILE_FLAG_DELETE_ON_CLOSE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 11:40