标签:
//表示清空 txt
StreamWriter sw = new StreamWriter("D:\\1.txt");
string w = "";
sw.Write(w);
sw.Close();
//表示向txt写入文本
StreamWriter sw = new StreamWriter("D:\\1.txt");
string w = "10";
sw.Write(w);
sw.Close();
//表示追加文本
StreamWriter sw =File.AppendText("D:\\1.txt");
string w = "2";
sw.Write(w);
//sw.WriteLine(w);
sw.Close();
标签:
原文地址:http://www.cnblogs.com/mybabyyh/p/4202430.html