首页 > 其他 > 详细

使用System.IO来读取以及修改文本文件

时间:2015-11-16 12:02:48      阅读:188      评论:0      收藏:0      [点我收藏+]
技术分享
 1 //读取html内容
 2 string htmlUrl = @"new\new.html";
 3 string htmlContent = string.Empty;
 4 using (StreamReader reader = new StreamReader(htmlUrl))
 5 {
 6        htmlContent += reader.ReadToEnd();
 7 }
 8 
 9 //修改html内容
10 string htmlContentNew = "新的html内容"; 
11 using (StreamWriter sw = new StreamWriter(url, false))
12 {
13        sw.Write(htmlContentNew );
14 }
View Code

 

使用System.IO来读取以及修改文本文件

原文:http://www.cnblogs.com/zhyue93/p/System_IO.html

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