string path = System.IO.Directory.GetCurrentDirectory();//相对路径 FileInfo fi = new FileInfo(path + @"\Data\unity.txt"); ////如果该文件存在需要删除重新写入 if (fi.Exists) { fi.Delete(); }
StreamWriter sw = new StreamWriter(path + @"\Data\StreamingAssets\unity.txt"); sw.WriteLine(需要写入的内容方法); sw.Close(); MessageBox.Show("写入成功! ^-^ ", "TaoHu", MessageBoxButtons.OK, MessageBoxIcon.None);
时间: 2024-10-20 15:05:26