分类: C/C++
2008-05-31 09:01:01
CString gray(\"Gray\");
CString cat(\"Cat\");
CString graycat = gray + cat;
要比用下面的方法好得多:
char gray[] = \"Gray\";
char cat[] = \"Cat\";
char * graycat = malloc(strlen(gray) + strlen(cat) + 1);
strcpy(graycat, gray);
strcat(graycat, cat);