zoukankan      html  css  js  c++  java
  • 在txt文本后追加内容

     public void CheckLog(string Log)
          {
                 if (File.Exists(LogFile))
                  {
                        WriteLog(Log);
                   }

                   else
                    {
                        CreateLog();
                        WriteLog(Log);
                   }
                }

             private void CreateLog()
               {
                    StreamWriter SW;
                    SW = File.CreateText(LogFile);
                    SW.WriteLine("Log created at: " +
                                         DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss"));
                    SW.Close();
               }

               private void WriteLog(string Log)
               {
                    using (StreamWriter SW = File.AppendText(LogFile))
                    {
                        SW.WriteLine(Log);
                        SW.Close();
                    }
               }

  • 相关阅读:
    Maven项目类型和JAVASE项目和JAVAEE项目的关系
    使用faker 生成测试数据
    python 面向对象
    python csv读写
    分治
    django 部署
    js 时间格式转换
    python环境
    枚举
    递归
  • 原文地址:https://www.cnblogs.com/gates/p/3549044.html
Copyright © 2011-2022 走看看