现在的位置: 首页 > 综合 > 正文

如何删除只读文件?

2012年10月09日 ⁄ 综合 ⁄ 共 756字 ⁄ 字号 评论关闭
参考:

http://msdn.microsoft.com/zh-cn/library/aa497275.aspx

使用 System.IO.FileInfo
类来访问文件属性


System.IO.FileInfo fi = new System.IO.FileInfo("filename");

// remove readonly attribute
if ((fi.Attributes & System.IO.FileAttributes.ReadOnly) != 0)
    fi.Attributes 
-= System.IO.FileAttributes.ReadOnly;

System.IO.File.Delete("filename");

 
 
 
 

--------------------------------------------------

李森 – listen
E-mail:  lisencool@gmail.com

声明:
这里集中了在WinCEWindows Mobile开发中的一些基本常识。我很乐意和大家分享,也希望大家提出意见,并给我投稿,我会第一时间替您发表并署上您的大名!

Announce:
Here collects general knowledge on WinCE and Windows mobile. I 'm very glad to share them with all friends, and also hope you can share your problems and opinions and contribute articles to me to share with others. I'll publish your articles and sign your name at the first time.

  



抱歉!评论已关闭.