Click to return to the Networking, Protocols     
InternetReadFileEx Functi...     InternetSetOption Functio...     General Win32 Internet Fu...    
Web Workshop  |  Networking, Protocols & Data Formats

InternetSetFilePointer Function


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

Syntax

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

Parameters

hFile
Valid HINTERNET 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
Long integer value that contains the number of bytes to move the file pointer. A positive value moves the pointer forward in the file; a negative value moves it backward.
pReserved
Reserved. Must be set to NULL.
dwMoveMethod
Unsigned long integer value that indicates the starting point for the file pointer move. This can be one of the following values:
FILE_BEGIN
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
Current value of the file pointer is the starting point.
FILE_END
Current end-of-file position is the starting point. This method fails if the content length is unknown.
dwContext
Reserved. Must be set to zero.

Return Value

Returns the current file position if the function succeeds, or -1 otherwise.

Remarks

This function cannot be used once the end of the 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 it cannot be used reliably with chunked transfers.

Function Information

Windows NT Use version 4.0. Implemented only as an ANSI function.
Windows Use Windows 95 and later. Implemented only as an ANSI function.
Header Wininet.h
Import library Wininet.lib
Minimum availability Internet Explorer 3.0

Windows CE

Windows CE Use version 2.12 and later
Minimum availability Internet Explorer 4.0

See Also

Microsoft Win32 Internet Functions Overview, Common Functions, Microsoft Win32 Internet Functions Reference, General Win32 Internet Functions



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.