将数据写入到文本文件中

1  StreamWriter sw = new StreamWriter(@"d:\log.txt",true);
2             sw.WriteLine(System.DateTime.Now.ToString() + " " + "This is a test message!");
3             sw.Flush();


 Tips: 1.True是为了将数据追加到最后.

posted @ 2014-05-02 07:20  菜鸟学CSharp  阅读(1217)  评论(0编辑  收藏  举报