建立StreamReader对象
New StreamReadere(文件路径,FileEncode)
StreamReader对象的 主要方法
ReadLine、ReadToEnded、Read(读取一个字符)、Peek、Close
建立StreamWriter对象
New StreamWriter(文件路径,FileMode,FileEncode)
StreamWriter对象的主要方法
WriteLine、Write, Flush (实际写到文件),Close
StreamReader re = new StreamReader(@"D:\aaa.log");
List<string> score = new List<string>();
string a = re.ReadLine();
while (a != null)
{
string[] b = a.Split(‘#‘);
score.Add(b[1]);
a = re.ReadLine();
}
StreamWriter writer = new StreamWriter(@"D:\aaa.log",true,Encoding.Default);