|
-
August 27th, 1999, 01:14 PM
#1
CString so slow
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|