The information in this article applies to:
SYMPTOMS
Calling CInternetFile::ReadString() without calling SetReadBufferSize()
first can result in lost data. If the file being read is less than 4096
bytes (the default read buffer size), a null string will be returned into
the buffer specified by the first argument of ReadString(). The
ReadString() function will also return NULL. If the file being read is
greater than 4096 bytes, the first 4096 bytes will be lost and then
subsequent ReadString() calls will return the rest of the data. CAUSEThere is a bug in CInternetFile::ReadString(). It calls InternetReadFile() twice. The second call to InternetReadFile() removes the data retrieved by the first call to InternetReadFile(). RESOLUTIONTo prevent ReadString from calling InternetReadFile() twice, call SetReadBufferSize() before making the first call to ReadString. This sets a read buffer, which means that the following code in ReadString is not executed:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was fixed in Visual C++ version 5.0. MORE INFORMATIONTo fix the problem in the TEAR sample, before the ReadString() call, add a call to SetReadBufferSize(). For example:
Additional query words: kbVC420bug kbDSupport WinInet Tear
Keywords : kbMFC kbSDKInet kbVC kbVC500fix |
Last Reviewed: July 29, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |