在上一篇写入txt的时候,不可以在后面追击,调用一次,以前的同名的文本就会覆盖掉。这次的功能会修改上次这个小bug
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 StreamWriter sw = new StreamWriter("D:\\" + DateTime.Today.ToString("yyyyMMdd") + ".txt", true); 2 3 sw.WriteLine("============================================================================"); 4 sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":"); 5 sw.WriteLine("asfsdf"); 6 sw.Close();