modernsky2003

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();

posted on 2008-02-27 11:34  hekeneng  阅读(6636)  评论(3编辑  收藏  举报

导航