CFile::Seek

virtualLONGSeek(LONGlOff**,UINTnFrom);**
throw(CFileException);

Return Value

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.

Parameters

lOff

Number of bytes to move the pointer.

nFrom

Pointer movement mode.  Must be one of the following values:

  • 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. Note that lOff must be negative to seek into the existing file; positive values will seek past the end of the file.

Remarks

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.

Example

//example for CFile::Seek
extern CFile cfile;
LONG lOffset = 1000, lActual;
lActual = cfile.Seek( lOffset, CFile::begin );

CFile OverviewClass MembersHierarchy Chart