This documentation is archived and is not being maintained.

CInternetFile::Seek 

This topic has been updated for Visual Studio 2005 SP1.

Call this member function to reposition the pointer in a previously opened file.


virtual ULONGLONG Seek( 
   LONGLONG lOffset, 
   UINT nFrom  
);

Parameters

lOffset

Offset in bytes to move the read/write pointer in the file.

nFrom

Relative reference for the offset. 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. lOff must be negative to seek into the existing file; positive values will seek past the end of the file.

The new byte offset from the beginning of the file if the requested position is legal; otherwise, the value is undefined and a CInternetException object is thrown.

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.

At this time, a call to this member function is only supported for data associated with CHttpFile objects. It is not supported for FTP or gopher requests. If you call Seek for one of these unsupported services, it will pass back you to the Win32 error code ERROR_INTERNET_INVALID_OPERATION.

When a file is opened, the file pointer is at offset 0, the beginning of the file.

NoteNote

Using Seek may cause an implicit call to Flush.

This method can throw exceptions of type CInternetException*.

See the example for the base class implementation (CFile::Seek).

This section has been updated for Visual Studio 2005 SP1.

This method is not supported in Smart Device projects.

Show: