CString s;
s="first";
s.Format("%s %s", s, "second");
That doesn't work but you catch my drift
CString s="There were ";
char a[50];
int v=4;
int u=2;
sprintf(a, "%d ducks", v);
s+=a;
sprintf(a, "and %d cats", u);
s+=a;
I'm wondering if there is a way to eliminate a and
the sprintf's (ie do it without allocating temp space).
Note that what I'm not showing is I'm building a BIG
CString full of many different run-time calculated/retrieved
values.
Lance S. Doddridge <lsdod...@earthlink.net.nospam> wrote in message
news:7g9oet$jtv$1...@holly.prod.itd.earthlink.net...
CString s;
int v=4;
int u=2;
s.Format(_T("There were %d ducks, and %d cats"), v, u);
- Anti_Snoop
http://www.snoopsoft.com
Jeff <phase_...@hotmail.com> wrote in message
news:O0vKPWlk#GA....@cppssbbsa02.microsoft.com...
If you are building a big CString, you will get massive reallocations if you
try to shuffle in data in the middle of the string. Have you thought about
using a 'straight' memory block instead, doing more primitive concatenations
with small temporary strings instead?
If you are just adding text to an existing string, as Lance (and I)
presumed, then you will loose little by using a temp for the Format, and the
just add it with +=.
Johan Rosengren
Responsable Informatique
PACTA S.A.
Jeff a écrit dans le message ...