首页 > Windows开发 > 详细

c#读写txt

时间:2014-10-29 12:23:08      阅读:352      评论:0      收藏:0      [点我收藏+]

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

写入到txt: StreamWrite sw2 =new StreamWrite(); sw.Write("写入内容");

最后都要 sw.Close();

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

 

c#读写txt

原文:http://www.cnblogs.com/heifengwll/p/4058938.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!