Cfile中怎么跳过一定字节读取数据;例如我不关心前50个字节的内容,我想直接读取后面的字节,
又如读取了一部分后,跳跃一部分,再读,怎么实现

解决方案 »

  1.   

    Repositions the file pointer in an open file.复制virtual ULONGLONG Seek(
       LONGLONG lOff,
       UINT nFrom 
    );
    参数
    lOff
    Number of bytes to move the file pointer. Positive values move the file pointer towards the end of the file; negative values move the file pointer towards the start of the file.nFrom
    Position to seek from. See the Res section for possible values.返回值
    The position of the file pointer if the method was successful; otherwise, the return value is undefined and a pointer to a CFileException exception is thrown.备注
    The following table lists possible values for the nFrom parameter.ValueDescriptionCFile::beginSeek from the start of the file.CFile::currentSeek from the current location of the file pointer.CFile::endSeek from the end of the file.When a file is opened, the file pointer is positioned at 0, the start of the file.You can set the file pointer to a position beyond the end of a file. If you do this, the size of the file does not increase until you write to the file.The exception handler for this method must delete the exception object after the exception is processed.
      

  2.   

    file.open()
    file.seek(50,CFile::begin)   
    file.read()