CHttp
-
TCHAR* buffer = new TCHAR[1024]; UINT ret = pFile->Read(buffer, 1024); while ( ret != 0 ) { buffer[ret] = TEXT('\0'); strText = buffer; OutWebResource += strText; ret = pFile->Read(buffer, 1024); } pFile->Close();
-
I used this read UNICODE data, but It seemed that there is always mem uninitialized. what's the matter?
I don`t understand what u really want but after declaring TCHAR... do a memset( &buffer, 0, sizeof(TCHAR)); NG
-
I don`t understand what u really want but after declaring TCHAR... do a memset( &buffer, 0, sizeof(TCHAR)); NG
-
TCHAR* buffer = new TCHAR[1024]; UINT ret = pFile->Read(buffer, 1024); while ( ret != 0 ) { buffer[ret] = TEXT('\0'); strText = buffer; OutWebResource += strText; ret = pFile->Read(buffer, 1024); } pFile->Close();
You should allocate one more byte for '\0' char. TCHAR* buffer = new TCHAR[1025]; " Action without vision is only passing time, Vision without action is merely day dreaming, But vision with action can change the world " - Words from Nelson Mandela Thanks & Regards, Gopalakrishnan
-
TCHAR* buffer = new TCHAR[1024]; UINT ret = pFile->Read(buffer, 1024); while ( ret != 0 ) { buffer[ret] = TEXT('\0'); strText = buffer; OutWebResource += strText; ret = pFile->Read(buffer, 1024); } pFile->Close();
If your
pFile->Read
call reads 1024TCHAR
's, thenret
has the value 1024. The linebuffer[ret] = TEXT('\0');
will then overrun the end ofbuffer
.
Software Zen:
delete this;
-
you have define UNICODE in your project because TCHAR type will have a size of 2 bytes then.... an CFile will work different or u can send by mail(to me) your file to see where.... NG -- modified at 10:27 Monday 5th September, 2005