C#操作txt问件,进行清空添加操作

     //把txt清空
FileStream stream = File.Open(Adr,FileMode.OpenOrCreate,FileAccess.Write);
stream.Seek(, SeekOrigin.Begin);
stream.SetLength();
stream.Close();
//向txt里面追加信息
StreamWriter sw = new StreamWriter(Adr,true,Encoding.GetEncoding("gb2312"));
sw.WriteLine(str);
sw.Flush();
sw.Close();
上一篇:Linux PS 命令详解


下一篇:POJ 2251 Dungeon Master /UVA 532 Dungeon Master / ZOJ 1940 Dungeon Master(广度优先搜索)