CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  语言基础/算法/系统设计

急:关于读文件的问题,希望各位多帮忙!!!

楼主btlxy(平凡)2006-07-03 15:43:32 在 Delphi / 语言基础/算法/系统设计 提问

chm的文件格式不知大家是否知道?  
  http://www.speakeasy.org/~russotto/chm/chmformat.html  
  我想读出chm文件的内容,请问如何操作呢? 问题点数:20、回复次数:7Top

1 楼lonoaer()回复于 2006-07-03 16:24:01 得分 0

既然已经知道文件的结构,那就好办了,用TFILESTREAM或者内存映射文件的方式都可以  
  我一般都用后者:fileopen,fileseek,   fileread,filecloseTop

2 楼btlxy(平凡)回复于 2006-07-03 16:29:07 得分 0

关键遇到了问题:  
  0000:   char[4]     'PMGL'  
  0004:   DWORD         Length   of   free   space   and/or   quickref   area   at   end   of  
                                directory   chunk    
  0008:   DWORD         Always   0.    
  000C:   DWORD         Chunk   number   of   previous   listing   chunk   when   reading  
                                directory   in   sequence   (-1   if   this   is   the   first   listing   chunk)  
  0010:   DWORD         Chunk   number   of   next   listing   chunk   when   reading  
                                directory   in   sequence   (-1   if   this   is   the   last   listing   chunk)  
  0014:   Directory   listing   entries   (to   quickref   area)     Sorted   by  
              filename;   the   sort   is   case-insensitive.  
   
  The   quickref   area   is   written   backwards   from   the   end   of   the   chunk.   One   quickref   entry   exists   for   every   n   entries   in   the   file,   where   n   is   calculated   as   1   +   (1   <<   quickref   density).   So   for   density   =   2,   n   =   5.    
   
  Chunklen-0002:   WORD           Number   of   entries   in   the   chunk  
  Chunklen-0004:   WORD           Offset   of   entry   n   from   entry   0  
  Chunklen-0008:   WORD           Offset   of   entry   2n   from   entry   0  
  Chunklen-000C:   WORD           Offset   of   entry   3n   from   entry   0  
  ...  
   
  The   format   of   a   directory   listing   entry   is   as   follows    
   
              ENCINT:   length   of   name  
              BYTEs:   name     (UTF-8   encoded)  
              ENCINT:   content   section  
              ENCINT:   offset  
              ENCINT:   length  
   
  不知道这时如何解决?Top

3 楼btlxy(平凡)回复于 2006-07-03 16:31:35 得分 0

我读到以上的地方,不知道如何办了?Top

4 楼lonoaer()回复于 2006-07-03 16:50:39 得分 0

0000:   char[4]     'PMGL'  
  fileseek(aHnd,   0,   0);  
  fileread(aHnd,   Buf,   4);  
  buf   ->   'PMGL'Top

5 楼btlxy(平凡)回复于 2006-07-03 17:02:56 得分 0

主要到了这里:  
  0014:   Directory   listing   entries   (to   quickref   area)     Sorted   by  
              filename;   the   sort   is   case-insensitive.  
  如何解决????Top

6 楼btlxy(平凡)回复于 2006-07-03 17:03:27 得分 0

如何读取?Top

7 楼btlxy(平凡)回复于 2006-07-04 08:25:13 得分 0

早上好!  
  希望大家多多帮忙!Top

相关问题

关键词

得分解答快速导航

  • 帖主:btlxy

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo