PDA

Click to See Complete Forum and Search --> : CStrings


ExciteMouse
Jan 6th, 2001, 07:54 PM
lets say i have this:


'//Make BUFFER have 10 nulls
unsigned char* BUFFER = (unsigned char*)malloc(10);
memset(BUFFER, 0x0, 10);

'//make a cstring and buffer it
CString MyStr;
MyStr.GetBufferSetLength(10);

'//Now how to i insert BUFFER to MyStr with out doing a loop and using MyStr.SetAt() ?

MyStr.ReleaseBuffer(0);
free(BUFFER);

ExciteMouse
Jan 6th, 2001, 08:52 PM
ok i got it.. all you do is use the CString::GetBuffer function.


memcpy(MyStr.GetBuffer(10), BUFFER, 10);