文件处理 文件结束是null while((str=f1.ReadLine())!=null) 打开文件是 StreamReader f1=new System.IO.StreamReader(of.FileName,System.Text.Encoding.Default ); 读文件要指定编码,写文件不用,直接写。