zoukankan      html  css  js  c++  java
  • C# 写入文件

            public void Write(string words)
            {

                var pathUrl = Server.MapPath("/UpFile/CamInfo");
                if (!Directory.Exists(pathUrl))
                {
                    Directory.CreateDirectory(pathUrl);
                }
                var path = pathUrl + "/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
                FileStream fs = new FileStream(path, FileMode.Create);
                StreamWriter sw = new StreamWriter(fs);
                //开始写入
                sw.Write(words);
                //清空缓冲区
                sw.Flush();
                //关闭流
                sw.Close();
                fs.Close();
            }

  • 相关阅读:
    form表单
    JsonResponse对象
    HttpRequest对象
    Django基础
    ssh私钥登录
    监控window目录是否为空自定义item
    redis频繁报错Cannot allocate memory
    脱敏html文件文件
    MySQL删除数据
    ftp服务器搭建
  • 原文地址:https://www.cnblogs.com/change4now/p/5665210.html
Copyright © 2011-2022 走看看