using System.IO; namespace streamWrite方法 { class Program { static void Main(string[] args) { string path = "D:\\123\\123.txt"; string conTent = "中华人民共和国万岁,世界人民大团结万岁!"; FileStream fs = new FileStream(path,FileMode.OpenOrCreate); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(conTent); //写入一行内容 sw.Close(); Console.Write("写入成功~!"); Console.ReadKey(); } } }
浙公网安备 33010602011771号