如何在C#中使用FILE_ATTRIBUTE_TEMPORARY创建文件? [英] How to create File with the FILE_ATTRIBUTE_TEMPORARY in C#?
本文介绍了如何在C#中使用FILE_ATTRIBUTE_TEMPORARY创建文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
我相信你将不得不使用P / Invoke调用本地 CreateFile
,然后使用 FileStream(SafeFileHandle,FileAccess)构造函数 FileStream
。 MSDN有一个示例,介绍如何使用SafeFileHandle和CreateFile在一起。
How to create File with the FILE_ATTRIBUTE_TEMPORARY in C#? (So to store Data in Ram but be able to use it as normal file)
解决方案
I believe you'll have to use P/Invoke to call the native CreateFile
then use the FileStream(SafeFileHandle, FileAccess) constructor on FileStream
. MSDN has a sample for how to use SafeFileHandle and CreateFile together.
这篇关于如何在C#中使用FILE_ATTRIBUTE_TEMPORARY创建文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文