c#读写txt
附加到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();
?
轉載于:https://www.cnblogs.com/heifengwll/p/4058938.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
- 上一篇: 实现Operations Manager
- 下一篇: 多媒体开发之wis-stream