String xx = "要写的内容";
String filePath = Request.PhysicalApplicationPath + "test\\2013-10-09.txt";
if (System.IO.File.Exists(filePath))
System.IO.File.WriteAllText(filePath, xx + System.IO.File.ReadAllText(filePath, System.Text.Encoding.GetEncoding("GB2312")), System.Text.Encoding.GetEncoding("GB2312"));
else
System.IO.File.WriteAllText(filePath, xx, System.Text.Encoding.GetEncoding("GB2312"));
读取文件并追加
最新推荐文章于 2022-09-29 10:35:40 发布