对于文件大小为10G或几十G的文件该如何寻址?又该如何获得文件当前位置指针?非常简单的问题,还请有实际使用经验的高手详细讲解!

解决方案 »

  1.   

    BOOL ReadFileEx(
      HANDLE hFile,                                       // handle to file
      LPVOID lpBuffer,                                    // data buffer
      DWORD nNumberOfBytesToRead,                         // number of bytes to read
      LPOVERLAPPED lpOverlapped,                          // offset
      LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine // completion routine
    );
    BOOL SetFilePointerEx(
      HANDLE hFile,                    // handle to file
      LARGE_INTEGER liDistanceToMove,  // bytes to move pointer
      PLARGE_INTEGER lpNewFilePointer, // new file pointer
      DWORD dwMoveMethod               // starting point
    );
    看看这两个api就明白了