标题:asp.net 读写文件流
只看楼主
跳过去
Rank: 8Rank: 8
等 级:贵宾
威 望:20
帖 子:282
专家分:976
注 册:2012-8-13
结帖率:91.3%
 问题点数:0 回复次数:1 
asp.net 读写文件流
怎么读取本地放着的Text文件的文章啊?
搜索更多相关主题的帖子: 文章 
2012-08-22 11:47
comeguojiaxi
Rank: 2
等 级:论坛游民
威 望:3
帖 子:30
专家分:73
注 册:2012-6-7
得分:0 
string path = Server.MapPath("D:\\doc\text.txt");
StreamReader read = new StreamReader(path);
while (read.Peek() >= 0)
{
//逐行读取数据
 string lineStr = read.ReadLine();
}
Server.MapPath能获取本机或服务器的绝对路径。
这个StreamReader的ReadLine()可以读文本文件的内容
2012-08-22 17:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-379911-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.637781 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved