| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2668 人关注过本帖
标题:如何设置文件属性既为隐藏又为只读?
只看楼主 加入收藏
hai0036
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-5-8
收藏
 问题点数:0 回复次数:2 
如何设置文件属性既为隐藏又为只读?
请教一下,在下列代码中,是设置文件属性为只读,那如何设置文件属性既为隐藏又为只读?
class Program
{
static void Main(string[] args)
{
FileStream fs = File.Create(@"c:\FileAttrib.txt");
fs.Close();
File.SetAttributes(@"c:\FileAttrib.txt",FileAttributes.ReadOnly);

FileAttributes fa=File .GetAttributes(@"c:\FileAttrib.txt");
Console .WriteLine ("属性:"+fa.ToString ());

}
}
谢谢,请不吝赐教!
搜索更多相关主题的帖子: 属性 文件 隐藏 
2007-05-08 09:05
guang
Rank: 4
来 自:广东深圳
等 级:贵宾
威 望:13
帖 子:1414
专家分:285
注 册:2006-4-3
收藏
得分:0 
File.SetAttributes(@"c:\FileAttrib.txt",FileAttributes.ReadOnly|FileAttributes.Hidden);

不相信未作牺牲竟先可拥有,只相信靠双手找到我的欲求!!
我的博客:http://liao5930.blog.
2007-05-08 11:16
hai0036
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-5-8
收藏
得分:0 
非常感谢,

2007-05-08 14:18
快速回复:如何设置文件属性既为隐藏又为只读?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011655 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved