附加到txt:StreamWriter sw =System.IO.File.AppendText(path); //绝对路径 sw.Write("写入内容");

写入到txt: StreamWriter sw2 =new StreamWriter(path); //绝对路径 sw.Write("写入内容");

最后都要 sw.Close();

读取txt:StreamReader sr = new StreamReader(path); //绝对路径   string line=""; while((line=sr.ReadLine())!=null){//操作行}  最后关闭流 sr.Close();

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2021-09-17
  • 2022-01-28
  • 2021-09-09
猜你喜欢
  • 2022-02-11
  • 2022-12-23
  • 2021-09-15
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案