| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5116 人关注过本帖
标题:怎么判断BinaryReader.Read()方法读到文件结束了
只看楼主 加入收藏
zzw5980_cn
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2006-7-24
收藏
 问题点数:0 回复次数:2 
怎么判断BinaryReader.Read()方法读到文件结束了
怎么判断BinaryReader.Read()方法读到文件结束了,我看有很多人用catch捕捉。
没有其他方法吗?
搜索更多相关主题的帖子: 文件结束 Read 判断 catch 
2006-07-28 16:41
purana
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
收藏
得分:0 

BinaryReader.Read 方法 () [C#]请参见
BinaryReader 类 | BinaryReader 成员 | System.IO 命名空间 | BinaryReader.Read 重载列表 | Encoding
要求
平台: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family
语言
C#

C++

JScript

Visual Basic

全部显示


从基础流中读取字符,并根据所使用的 Encoding 和从流中读取的特定字符,提升流的当前位置。

[Visual Basic]
Overridable Overloads Public Function Read() As Integer
[C#]
public virtual int Read();
[C++]
public: virtual int Read();
[JScript]
public function Read() : int;
返回值
输入流中的下一个字符,如果当前无可用字符则为 -1


我的msn: myfend@
2006-07-28 17:12
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
收藏
得分:0 
沒必要去判斷它讀到末尾吧
一般都
for(i=0;i<stream.length;i++)
{
read
}
或者直接read(byte[],0,stream.length)

或許可以用stream.position判斷指針位置,試試

[url=javascript:alert(1);] [div]fdgfdgfdg\" on\"[/div] [/url]
2006-07-28 17:34
快速回复:怎么判断BinaryReader.Read()方法读到文件结束了
数据加载中...
 
   



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

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