天天看點

檔案操作

一、建立檔案,删除檔案

//建立檔案
            string iniPath = @"D:\1\2.txt";
            if (!System.IO.File.Exists(iniPath))
            {
                using (StreamWriter sw = new StreamWriter(iniPath, false, Encoding.UTF8))
                {
                    sw.Write(iniPath);
                }
            }
            //删除檔案
            if (System.IO.File.Exists(iniPath))
            {
                System.IO.File.Delete(iniPath);
            }      

繼續閱讀