c# 處理文件流

版權聲明:本文爲博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/ranran125/article/details/78726673

文件的讀取 

 string filepath = System.Web.HttpContext.Current.Server.MapPath("../../GetConfig.js");
            using (StreamWriter sw = new StreamWriter(filepath))
            {
                sw.Write(scripts);//寫文件
            }

找到該文件覆蓋裏邊所有的的內容



文件的寫入



  string file = Server.MapPath("~/resources/json/door/text.json");
        string doordata = string.Empty;//讀文件流
        if (File.Exists(file))
        {
            using (StreamReader sr = new StreamReader(file))
            {
                doordata = sr.ReadToEnd();//讀文件
               
            }
        }


吐舌頭此處結束哦!







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章