因为读取的是流文件,都比较大,为了不让用户等待太长时间,所以将文件按4K一段,进行划分。
现在问题是 当一个文件顺序(第一个4K读完,接着读第二个4K)读下来的时候,速度还是可以的,但是跳跃读的时候(比如原来顺序读到第二个4K了,但用户终止了这个读取,直接拖到第10个4K那里开始读),那么等待的时间就比较长了,有时达到1分钟,那就绝对不行了问大哥们,怎么样才能在这样的情况下,加快读取的速度呢?????我想是不是每次操作的都要解析文件有几个4K,并标识。但顺序读取也解析了,速度还可以啊,如果真是这个原因,该如何解决呢????

解决方案 »

  1.   

    映射文件
    File Mapping Functions
    The following functions are used with file mapping. Function Description 
    CreateFileMapping Creates or opens a named or unnamed file-mapping object for the specified file. 
    FlushViewOfFile Writes to the disk a byte range within a mapped view of a file. 
    MapViewOfFile Maps a view of a file into the address space of the calling process. 
    MapViewOfFileEx Maps a view of a file into the address space of the calling process. 
    OpenFileMapping Opens a named file-mapping object. 
    UnmapViewOfFile Unmaps a mapped view of a file from the calling process's address space. 
      

  2.   

    晕  vcmute(横秋) 
    英文不行 能翻译下 或说的通俗点吗
      

  3.   

    vcmute(横秋) 只不过列出几个函数,自己找MSDN看看啦。
      

  4.   

    我是CS模式 的文件都在server端 filemapping 好象只能对本地文件进行操作吧
      

  5.   

    你读取的时间已经获得了文件句并阿
    用seekfile应该很快阿,不管多大的文件应该都不慢
      

  6.   

    up  继续先问filemapping 好象只能对server端文件操作吗?
      

  7.   

    错了 是不能对server端文件操作???????
      

  8.   

    to lizmei001(暗黑) 
           seekfile 能用到server端吗 好象也是客户端的吧