virtual LONG Seek( LONG lOff, UINT wFrom )
throw( CFileException );
lOff
Number of bytes to move the pointer.
wFrom
Pointer movement mode. Must be one of the following:
Value | Meaning |
CFile::begin | Move the file pointer lOff bytes forward from the beginning of the file. |
CFile::current | Move the file pointer lOff bytes from the current position in the file. |
CFile::end | Move the file pointer lOff bytes from the end of the file. |
Repositions the pointer in a previously opened file. The Seek function permits random access to a file's contents by moving the pointer a specified amount, absolutely or relatively. No data is actually read during the seek.
When a file is opened, the file pointer is positioned at offset 0, the beginning of
the file.
If the requested position is legal, Seek returns the new byte offset from the beginning of the file. Otherwise, the return value is undefined, and a CFileException object is thrown.
extern CFile cfile;
LONG lOffset = 1000, lActual;
lActual = cfile.Seek( lOffset, CFile::begin );