InternetSetFilePointerInternetSetFilePointer*
*Contents  *Index  *Topic Contents
*Previous Topic: InternetReadFileEx
*Next Topic: InternetSetOption

InternetSetFilePointer

DWORD InternetSetFilePointer(
    IN HINTERNET hFile,
    IN LONG lDistanceToMove,
    IN PVOID pReserved,
    IN DWORD dwMoveMethod,
    IN DWORD dwContext
);

Sets a file position for InternetReadFile. This is a synchronous call; however, subsequent calls to InternetReadFile may block or return pending if the data is not available from the cache and the server does not support random access.

hFile
Valid handle returned from a previous call to InternetOpenUrl (on an HTTP or HTTPS URL) or HttpOpenRequest (using the GET or HEAD method and passed to HttpSendRequest or HttpSendRequestEx). This handle must not have been created with the INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_NO_CACHE_WRITE value set.
lDistanceToMove
Number of bytes to move the file pointer. A positive value moves the pointer forward in the file, and a negative value moves it backward.
pReserved
Reserved; must be NULL.
dwMoveMethod
Starting point for the file pointer move. Can be one of the following values:
FILE_BEGIN The starting point is zero or the beginning of the file. If FILE_BEGIN is specified, lDistanceToMove is interpreted as an unsigned location for the new file pointer.
FILE_CURRENT The current value of the file pointer is the starting point.
FILE_END The current end-of-file position is the starting point. This method fails if the content length is unknown.
dwContext
Reserved; must be zero.

This function cannot be used once the end of file has been reached by InternetReadFile.

For HINTERNET handles created by HttpOpenRequest and sent by HttpSendRequestEx, a call to HttpEndRequest must be made on the handle before InternetSetFilePointer is used.

InternetSetFilePointer cannot be used reliably if the content length is unknown and with chunked transfers.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.