using System;
using System.IO;namespace IO操作
{class Program{private const string FILE_NAME="IO.txt";static void Main(string[] args){if (!File.Exists(FILE_NAME)){Console.WriteLine("{0}does not exists!",FILE_NAME);Console.ReadLine();return;}//方法一://FileStream FS = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read);//BinaryReader BR = new BinaryReader(FS);//for (int i = 0; i < 1; i++)//{// Console.WriteLine(BR.ReadString());//}//BR.Close();//FS.Close();//Console.ReadLine();//方法一:using (StreamReader SR = File.OpenText(FILE_NAME)){string input;while ((input = SR.ReadLine()) != null){Console.WriteLine(input);}Console.WriteLine("The end of the txt");Console.ReadLine();SR.Close();}}}
}