C#读文件操作
来源:互联网 发布:别墅设计软件下载 编辑:程序博客网 时间:2024/05/20 00:13
using System;using System.IO;namespace IO操作{ class Program { private const string FILE_NAME="IO.txt"; static void Main(string[] args) { if (!File.Exists(FILE_NAME)) { Console.WriteLine("{0}does not exists!",FILE_NAME); Console.ReadLine(); return; } //方法一: //FileStream FS = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read); //BinaryReader BR = new BinaryReader(FS); //for (int i = 0; i < 1; i++) //{ // Console.WriteLine(BR.ReadString()); //} //BR.Close(); //FS.Close(); //Console.ReadLine(); //方法一: using (StreamReader SR = File.OpenText(FILE_NAME)) { string input; while ((input = SR.ReadLine()) != null) { Console.WriteLine(input); } Console.WriteLine("The end of the txt"); Console.ReadLine(); SR.Close(); } } }}
0 0
- C#读文件操作
- C#中的文件操作
- C# 文件操作
- C# 文件操作
- c#文件操作
- C#中的文件操作
- C#文件操作
- c#文件操作
- C# 文件操作相关
- c# 常用文件操作
- c# 常用文件操作
- C#操作文件
- C# 文件操作
- c#文件操作
- C# 文件操作
- c#文件操作
- C# 文件操作
- (转)c#文件操作
- Activity生命执行中的几个方法
- C#:异步编程和线程的使用(.NET 4.5 )
- 帝友P2P任意密码支付密码重置让我超越马云爸爸不再是梦想
- usleep()和sleep()的区别
- 【 数据结构】实现二叉树以及其基本操作
- C#读文件操作
- libc++abi.dylib: terminate_handler unexpectedly threw an exception
- 浅谈Spring事务隔离级别
- 04Top K算法问题
- Java线程_wait,sleep,notify,notifyall,join
- 【剑指offer】 面试题7: 用两个栈实现队列
- 动态计算UITableviewCell高度
- JS 传值到jsp 中文字符乱码
- 将OSG嵌入QT窗口系统中,实现拖拽界面