采用文件流方式来处理,StreamReader,StreamWriter:
StreamReader sr = new StreamReader("c:\\a.txt");
while(!sr.EndOfStream) //读到文件流结尾退出 {
string temp = sr.ReadLine(); // 一行一行的读
}
sr.Close();
StreamWriter sw = new StreamWriter("c:\\a.txt"); sw.WriteLine("your content"); // 没调用一次 写入一行 sw.Close();