Click to See Complete Forum and Search --> : read/write file


mhc
October 14th, 1999, 04:49 AM
I write a program in read/write file.Besides, if I want to send binary files through CSocket, what i should indicate?(becasuse i find that i can send text file sucessfully, but
I fail in sending a binary file. I only send first 4 bytes of the file then stop.

If I write the following:
CString buffer=m_pBuffer;

where m_pBuffer is char*
are there any problem if I assign this?

rldkfl
October 14th, 1999, 08:29 AM
This will create object that contain all characters from m_pBuffer to the occurence of '\0'

Constructur of CString think that m_pBuffer
is zero-terminated string (C-style string)
Thus all remaining chars after '\0' will be
truncated
Also if in the block pointed from m_pBuffer
no one character is '\0' constuctor will access
illegal memory after this block