I have a big string to construct from separate pieces using the following code:

CString str;
for (int idx = 0; idx < nbrItems; idx++)
{
str += items[idx];
}

This code gets extremely slow when nbrItems is > 1000. I guess this is because memory needs to be reallocated every time.

I ended up allocating memory large enough to hold the entire string, construct using strcpy() and then assign this buffer to CString. This works fast.

Is there a better way to do this. The reason for using CString is because I'm setting up variable for CEdit control.

Thanks