C#追加内容到文本文件中

using SYSTEM.IO; 
//C#追加文件
 StreamWriter sw=File.AppendText(Server.MapPath(".")+" \\myText.txt");
 sw.WriteLine("追逐理想");
 sw.WriteLine("kzlll");
 sw.WriteLine(".NET笔记");
 sw.Flush();
 sw.Close();

     StreamWriter sw=File.AppendText(System.Windows.Forms.Application.StartupPath+"\\lgcx.log");
     sw.WriteLine(SysLog.FProgramName+SysLog.FCreateName+SysLog.FTime+SysLog.FId+SysLog.FPath+SysLog.FDesc);
     //sw.WriteLine("kzlll1");
     //sw.WriteLine(".NET笔记1");
     sw.Flush();
     sw.Close();

转载于:https://www.cnblogs.com/modernsky2003/archive/2008/02/27/1083485.html

你可能感兴趣的:(C#追加内容到文本文件中)