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.
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.
file.seek(50,CFile::begin)
file.read()