Delphi用于读写的三种文件类型.pdfVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Delphi用于读写的三种文件类型

Delphi用于读写的三种文件类型 一.旧pascal文件类型 用旧文件变量表示的文件类型,比如 f:text,f:file. 定义了三类:有类型,无类型,字符类型以及一些delphi 的文件操作函数.比如:assignprn,writeln,这些文件类和windows文件句柄不兼容 二.windows文件句柄(handle) 面向对象的pascal的文件句柄封装了windows文件句柄类型,文件操作函数库则封装了windows api函数,比 如fileread就是调用了windows api 函数readfile,delphi提供了一个windows api操作接口如果熟悉 windows api,可以用windows文件句进行文件操作. 三.文件流(file streams) 文件流是tfilestream类的对象实例,文件流是高层的文件操作类型,tfilestream提供了一个句柄属性.用此 属性可操作windows文件句柄类型. 如何选择文件类型 windows文件句柄是较底层的文件操作类型,提供了灵活的同步及异步文件读写控制,以下提供用windows文件 句柄类型对文件同步及异步操作的伪代码描述: 同步操作: bresult = readfile(hfile, inbu er, nbytestoread, nbytesread, null) ; // check for eof if (bresult nbytesread == 0, ) { // we’re at the end of the file } 步操作: // set up overlapped structure fields goverlapped.o set = 0; goverlapped.o sethigh = 0; goverlapped.hevent = null; // attempt an asynchronous read operation bresult = readfile(hfile, inbu er, nbytestoread, nbytesread, 1 goverlapped) ; // if there was a problem, or the async. operation’s still pending ... if (!bresult) { // deal with the error code switch (dwerror = getlasterror()) { case error_handle_eof: { // we’re reached the end of the file // during the call to readfile // code to handle that } case error_io_pending: { // asynchronous i/o is still in progress // do something else for a while godosomethingelse() ; // check on the results of the asynchronous read bresult = getoverlappedresult(hfile, goverlapped, nbytesread, false) ; // if there was a problem ... if (!bresult) { 2 // deal with the error code switch (dwerror = get

文档评论(0)

hhuiws1482 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

版权声明书
用户编号:5024214302000003

1亿VIP精品文档

相关文档