首页 > Windows开发 > 详细

c# 文件读取

时间:2015-02-26 13:01:02      阅读:213      评论:0      收藏:0      [点我收藏+]

using System;
using System.IO;


class FileTest
{
public static void Main()
{
StreamReader srd;

 string path = @"c:\temp\MyTest.txt";


try
{
srd = File.OpenText (path);

}
catch
{
Console.WriteLine("File open failed");
return;
}
while (srd.Peek() != -1)
{
String str = srd.ReadLine();
Console.WriteLine(str);
Console.ReadKey();
}

}
}

c# 文件读取

原文:http://www.cnblogs.com/xblydy/p/4300944.html

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