All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
缓存技术详谈—php_php资料_编程技术
通过缓存数据库结果提高PHP性能_[PHP教程]
SQL循序渐进(14)组合条件和布尔运算符_[SQL,Server教程]
ADO.NET与数据源连接的对象Connection
FreeBSD5.3下安装Apache+PHP+MySQL+Tomcat_[PHP教程]
SQL Server 2000 分布式事务错误解决_[SQL Server教程]
Visual C++向对话框类中添加工具栏
复杂ASP.NET服务器控件调整小技巧_.net资料_编程技术
visual c++中图形设备接口概述
圣殿骑兵PHP,2007年Web开发技术预言_php资料_编程技术
Reading number is top 10 pictures
Absolutely shocked. National geographic 50 animal photographys1
Photographed the passion of the clients and prostitutes in the sex trade picture1
美丽的少女1
NeedWallpaper6
这酸爽,让人不敢相信
含苞欲放的素颜美少女3
漂亮脸蛋魔鬼身材1
China's ambassador to Libya embassy was shock, and the glass is broken in
The money of more than 100 countries and regions11
Take you to walk into the most true north Korea rural1
Download software ranking
Sora aoi's film--cangkong_Blue.Sky
C#高级编程(第4版)
WebService在.NET中的实战应用教学视频 → 第1集
功夫熊猫2(下集)
Sora aoi 120 minutes
Eclipse 4.2.1 For Win32
Tram sex maniac 2 (H) rar bag18
SP3 for SQL2000
Boxer's Top ten classic battle8
Take off clothes to survival
delv published in(发表于) 2014/1/6 9:02:53 Edit(编辑)
ASP.NET中的STREAMREADER对象总结_[Asp.Net教程]

ASP.NET中的STREAMREADER对象总结_[Asp.Net教程]

ASP.NET中的STREAMREADER对象总结_[Asp.Net教程]

前面我介绍了file和filestream,我介绍system.io空间下的这些对象目的是为后面讲解如何制作asp.net计数器打下伏笔。呵呵,下面继续讲解StreamReader对象。
  
  streamreader对象是最直接对文件进行读取的对象,也是读写操作中最重要的对象之一。
  
  创建streamreader对象
  
  创建streamreader对象可以使用file对象的opentext方法或者streamreader对象的构造函数。
  
  使用file对象的opentext方法
  dim mikecatreader as streamreader
  dim mikecatfile as new file("c:\mikecat.txt")
  mikecatreader=mikecatfile.opentext()
  
  使用streamreader对象的构造函数
  dim mikecatreader as new streamreader("c:\mikecat.txt")
  
  streamreader对象的主要方法
  
  streamreader对象实现对文件的读取操作
  
  (1)close方法
   close方法是streamreader对象必须使用的方法,在使用streamreader对象执行完了读取操作后必须使用close方法来释放streamreader对象操作的文件和其他系统资源。如果不使用close方法,其他的进程将不能对文件进行任何操作。
  
   sub close()
  
  (2)read方法
  该方法用来读取一个字符或者一个字符集。用于读取一个字符时function read() as integer每读取一个字符,文件流的当前位置向后移动一个字符。
  用于读取一个字符集时function read(buffer(),index,count) as integer参数buffer()是用于接受读取字符的缓冲区,index参数是读取的起始位置[],count参数是读取字符的[b]最大个数[/b],返回值为读取的实际字符数,返回值一般是等于count值的,除非到了文件的末尾。
  
  (3)readline方法
  该方法用于读取一行数据,在文件中一行数据是以回车符号作为结束标志
  function readline() as string
  
  (4)readblock方法
  该方法用于读取数据块
  function readblock(buffer(),index,count) as integer
  readblock方法和read方法基本相似。
  
  (5)readtoend方法
  该方法用于将文件中的所有数据一次读出来
  function readtoend() as string
  使用该方法需要注意的是,接受返回值的字符串缓冲区必须定义得足够大,否则容易导致溢出





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.