如何将只读文件设为可写! System.IO.File.SetAttributesSystem.IO.FileAttributes.ReadOnly 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string fileName = "c:\\aa.txt";System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.Normal); //更新文件的属性为一般属性,即可写。 string fileName = "c:\\aa.xml";System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.Normal); //更新文件的属性为一般属性,即可写。 string fileName = "D:\test.xml"XmlDocument xml = new XmlDocument();xml.Load(fileName);XmlNodeList tagList = xml.SelectNodes("/testInfo/" + "add[@key='" + key + "']");tagList.Item(0).SelectSingleNode("@name").Value ="aaaa";System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.Normal);XmlTextWriter writer = new XmlTextWriter(fileName,null); xml.Save(writer);System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.ReadOnly);不知道是不是符合你的要求 c#调用DOS操作命令失败 关于SQL语句的简单问题 Server2003 SMTP邮件无法发送 急求!各位高手能不能帮小弟一下? 急!实现类似windows鼠标选择多个文件的功能! 高手帮帮忙 ,谢谢! 欢迎试用Snake.Net 请大家推荐一本用C#写的.net的入门书,有案例的更好。现在很多书的都是东拼西抄,质量太次的多,怕买错。 有点难度:存储过程参数为数组(SQL SERVER)(在线等待) gif要怎么打包,我创建了一个IMAGES子目录,居然不行,安装完后图骗全没了 winform有什么空件可以用来画表格 如制在一个类似于“上网助手”之类的嵌入ie的控制,
System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.Normal); //更新文件的属性为一般属性,即可写。
System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.Normal); //更新文件的属性为一般属性,即可写。
XmlDocument xml = new XmlDocument();
xml.Load(fileName);
XmlNodeList tagList = xml.SelectNodes("/testInfo/" + "add[@key='" + key + "']");
tagList.Item(0).SelectSingleNode("@name").Value ="aaaa";System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.Normal);
XmlTextWriter writer = new XmlTextWriter(fileName,null);
xml.Save(writer);
System.IO.File.SetAttributes(fileName, System.IO.FileAttributes.ReadOnly);
不知道是不是符合你的要求