日志文件

 public static void TextWriter(string Msg)
        {
            string path = @"D: " + "log.txt";
            //文件流
            FileStream file = new FileStream(path, FileMode.Append);
            StreamWriter sw = new StreamWriter(file);
            sw.WriteLine(DateTime.Now.ToString("yyyyMMdd hh:mm ->" + Msg));
            file.Close();
            sw.Close();
        }

上一篇:IO 操作


下一篇:Stream、FileStream、MemoryStream的区别