C#读文件代码
using System;
using System.IO;
public class TestReadFile
{
public static void Main(String[] args)
{
// 创建文件流,读取文件的路径
FileStream fs = new FileStream(@c:\temp\test.txt , FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
String line=sr.ReadLine();
while (line!=null)
{
Console.WriteLine(line);
line=sr.ReadLine();
}
sr.Close();
fs.Close();
}
}
posted on 2008-09-01 23:51 VictorShan 阅读(516) 评论(0) 收藏 举报
浙公网安备 33010602011771号