C# txt文件写入,若不存在则生成文件,若存在则直接追加写入
if (!System.IO.File.Exists(path))
{
FileStream fs1 = new FileStream(path, FileMode.Create,
FileAccess.Write);//创建写入文件
System.IO.File.SetAttributes(path, FileAttributes.ReadOnly); //设置文件属性为只读
StreamWriter sw = new StreamWriter(fs1, Encodi
原创
2020-11-24 14:36:43 ·
2219 阅读 ·
0 评论