Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetFilePointer() return values

161 views
Skip to first unread message

Jon Trauntvein

unread,
Mar 2, 2001, 2:23:00 PM3/2/01
to
The MSDN documentation for the SetFilePointer() Win32 function says
that if the function fails and the lpDistanceToMoveHigh parameter is
null than the return value will be INVALID_SET_FILE_POINTER. I am
attempting to use this function in this way and am checking against
the given return value only the compiler complains because the symbol
INVALID_SET_FILE_POINTER is unknown. I have searched my visual c++
compiler's entire include directory but have not found that symbol's
definition. What am I missing?

Regards,

Jon Trauntvein

Neil Butterworth

unread,
Mar 2, 2001, 2:31:40 PM3/2/01
to
"Jon Trauntvein" <j...@campbellsci.com> wrote in message
news:ug0gwq...@campbellsci.com...

In my copy of the MSDN, the return value is documented as follows:

<quote>

Return Values
If the SetFilePointer function succeeds and lpDistanceToMoveHigh is NULL,
the return value is the low-order DWORD of the new file pointer. If
lpDistanceToMoveHigh is not NULL, the function returns the low order DWORD
of the new file pointer, and puts the high-order DWORD of the new file
pointer into the LONG pointed to by that parameter.

If the function fails and lpDistanceToMoveHigh is NULL, the return value is
0xFFFFFFFF. To get extended error information, call GetLastError.

If the function fails, and lpDistanceToMoveHigh is non-NULL, the return
value is 0xFFFFFFFF. However, because 0xFFFFFFFF is a valid value for the
low-order DWORD of the new file pointer, you must check GetLastError to
determine whether an error occurred. If an error occurred, GetLastError
returns a value other than NO_ERROR. For a code example that illustrates
this point, see the Remarks section later in this topic.

If the new file pointer would have been a negative value, the function
fails, the file pointer is not moved, and the code returned by GetLastError
is ERROR_NEGATIVE_SEEK.

</quote>

I don't see any mention of INVALID_SET_FILE_POINTER, and a search failed to
find this string.

NeilB

Steve Fallows

unread,
Mar 2, 2001, 3:11:23 PM3/2/01
to
I discovered this discrepancy before. My July 2000 MSDN still references
INVALID_SET_FILE_POINTER on the SetFilePointer() page.

My guess is Neil has later MSDN and they "fixed" the docs rather than
the headers...

HTH
Steve

Neil Butterworth

unread,
Mar 2, 2001, 3:40:21 PM3/2/01
to
"Steve Fallows" <sfal...@NOSPAMacuson.com> wrote in message
news:3A9FFE6B...@NOSPAMacuson.com...

> I discovered this discrepancy before. My July 2000 MSDN still references
> INVALID_SET_FILE_POINTER on the SetFilePointer() page.
>
> My guess is Neil has later MSDN and they "fixed" the docs rather than
> the headers...

My MSDN CD is one that came with a copy of VC++ 6 I purchased sometime
mid-1999, so maybe the problem is is with more recent versions!

NeilB


Vincent Fatica

unread,
Mar 2, 2001, 3:48:48 PM3/2/01
to
INVALID_SET_FILE_POINTER is defined as ((DWORD)-1) in my SDK's WINBASE.H
(line 58) (and it is not defined in VC6's WINBASE.H).

- Vince

Vincent Fatica
vefa...@syr.edu
Syracuse University Mathematics
http://barnyard.syr.edu/~vefatica/

0 new messages