M
Manfred Huber
Hello,
sometimes the source code below raises following exception:
HEAP[Test.exe]: HEAP: Free Heap block cda1788 modified at cda1880 after it
was freed
Unhandled exception at 0x77f65a58 in Test.exe: User breakpoint.
This exception is only raised a few times. Sometimes the code works without
that exception. The Debugger stops at the line "iReadByte =
lStream->ReadByte ();"
String* CDownload:ownloadEx(String *strUrl, String* strFileName,
System::Windows::Forms::Label* StatusLabel)
{
WebRequest* lRequest = HttpWebRequest::Create (strUrl);
HttpWebResponse* lResponse = (HttpWebResponse*)lRequest->GetResponse ();
System::IO::Stream* lStream = lResponse->GetResponseStream ();
int iReadByte = 0;
unsigned long lBytes = 0;
StringBuilder* lString = new StringBuilder();
iReadByte = lStream->ReadByte ();
if (iReadByte == -1)
{
return "";
}
do
{
lString->Append (Convert::ToChar (iReadByte));
iReadByte = lStream->ReadByte ();
} while (iReadByte != -1);
lStream->Close ();
return lString->ToString ();
}
sometimes the source code below raises following exception:
HEAP[Test.exe]: HEAP: Free Heap block cda1788 modified at cda1880 after it
was freed
Unhandled exception at 0x77f65a58 in Test.exe: User breakpoint.
This exception is only raised a few times. Sometimes the code works without
that exception. The Debugger stops at the line "iReadByte =
lStream->ReadByte ();"
String* CDownload:ownloadEx(String *strUrl, String* strFileName,
System::Windows::Forms::Label* StatusLabel)
{
WebRequest* lRequest = HttpWebRequest::Create (strUrl);
HttpWebResponse* lResponse = (HttpWebResponse*)lRequest->GetResponse ();
System::IO::Stream* lStream = lResponse->GetResponseStream ();
int iReadByte = 0;
unsigned long lBytes = 0;
StringBuilder* lString = new StringBuilder();
iReadByte = lStream->ReadByte ();
if (iReadByte == -1)
{
return "";
}
do
{
lString->Append (Convert::ToChar (iReadByte));
iReadByte = lStream->ReadByte ();
} while (iReadByte != -1);
lStream->Close ();
return lString->ToString ();
}