C#寫入或生成新的TXT檔案中
public void CreatTxt() {
string str=" "; if (!File.Exists("C:\\Users\\Administrator\\Desktop\\快點我.txt")) { StreamWriter strmsave = new StreamWriter("C:\\Users\\Administrator\\Desktop\\快點我.txt", false, System.Text.Encoding.Default); strmsave.WriteLine(str); Console.WriteLine("寫入完成"); strmsave.Close(); } else { StreamWriter strmsave = new StreamWriter("C:\\Users\\Administrator\\Desktop\\快點我.txt", false, System.Text.Encoding.Default); strmsave.WriteLine(str); Console.WriteLine("寫入完成"); strmsave.Close(); } }