#region FileStream读取txt文件 //using (FileStream fileStream = new FileStream(@"C:UsersadminDesktop1.txt", FileMode.OpenOrCreate, FileAccess.Read)) //{ // byte[] buffer = new byte[1024 * 1024 * 5]; // int r = fileStream.Read(buffer, 0, buffer.Length); // string str = Encoding.UTF8.GetString(buffer, 0, r); // Console.WriteLine(str); // Console.ReadKey(); //} #endregion #region //using (FileStream fileStream = new FileStream(@"C:UsersadminDesktop1.txt", FileMode.OpenOrCreate, FileAccess.Write)) //{ // string str = "我是写入的文本!"; // byte[] buffer = Encoding.UTF8.GetBytes(str); // fileStream.Write(buffer, 0, buffer.Length); //} //Console.WriteLine("写入成功!"); //Console.ReadKey(); #endregion