zoukankan
html css js c++ java
在ASP.NET去掉文件的只读属性
我们可以使用 System.IO.File 类的 SetAttributes 方法为一个文件设置相关的属性,如:
//
为文件加上一个只读的属性
FileAttributes attrs
=
File.GetAttributes(
"
c:\\a.txt
"
);
File.SetAttributes(
"
c:\\a.txt
"
, attrs
|
FileAttributes.ReadOnly);
怎么把这个只读属性去掉呢?
//
先把文件的属性读取出来
FileAttributes attrs
=
File.GetAttributes(
"
c:\\a.txt
"
);
//
下面表达式中的 1 是 FileAttributes.ReadOnly 的值
// 此表达式是把 ReadOnly 所在的位改成 0,
attrs
=
(FileAttributes)((
int
)attrs
&
~
(
1
));
File.SetAttributes(
"
c:\\a.txt
"
, attrs);
查看全文
相关阅读:
Servlet----------在 Servlet 中的xml配置
java连接数据库时的报错
借用HTML5 插入视频。音频
多线程的总结
穷举法例子
利用递归求最大公约数和最小公倍数
递归逆序的使用
Mac OS X运行程序出现bad interpreter: operation not permitted的解决方案
C#之枚举类型
窗体的单例模式
原文地址:https://www.cnblogs.com/kuku/p/81630.html
最新文章
Calendar类实现当前日期的日历
HashSet的运用
Math类
枚举在switch中的运用
枚举
DateFormat 日期格式化类(必须掌握)
sql.date
观察者模式------《Head First 设计模式》
策略模式------《Head First 设计模式》
计算器work_day05
热门文章
Python天天学_05_模块
Python天天学_04_基础四
Python天天学_03_基础三
day_work_02
Python天天学_02_基础二
day_work_01
Python天天学_01_基础1
Servlet----------用servlet写一个“网站访问量统计“的小案例
Servlet----------ServletContext (重要)
Servlet----------Servlet 的映射路径细节
Copyright © 2011-2022 走看看