Article 2719 of microsoft.public.win32.programmer.kernel:
Hi,

I have just discovered a very strange behavior of SetFilePointer (called by
CFile::Seek).

A bug in one of my routines has caused CFile::Seek to be called with
offsets far larger than the actual file size. However, this didn't generate
any exception. I have traced down the call in the MFC sources and found out
that the problem comes from ::SetFilePointer which obviously accepts
invalid seek offsets.

For example I have just tested a file which has a size of 852404 bytes.
MyFile.Seek(1200000, CFile::begin) generates a call to
SetFilePointer(m_hFile, 1200000, NULL, 0) which returns 1200000 (??!!??).

However, trying to read at this offset generates an error as expected.

Anyone aware of this problem?

-- 

Patrick Philippot

-pp (MainSoft sarl)
------------------------------------

patrick.philippot@hol.fr
Compuserve: mainsoft / mainsoft@compuserve.com
http://ourworld.compuserve.com/homepages/mainsoft
tel/fax: +33 (0)1 69 40 94 85