class Program { static void Main(string[] args) { //FileStream 写入文件 //FileMode.Create 新内容覆盖老内容 FileStream fs = new FileStream(@"C:\Users\Administrator\Desktop\C#OOP练习\my.txt",FileMode.Create); byte[] bytes1 = Encoding.Default.GetBytes("如鹏网你好\r\n"); fs.Write(bytes1, 0, bytes1.Length); byte[] bytes2 = Encoding.Default.GetBytes("Hello,如鹏网!"); fs.Write(bytes2, 0, bytes2.Length); fs.Close(); } }
时间: 2024-12-28 09:10:33