7 static inline char *cstrcat(int n, ...) {
8 int len = 0; va_list va; va_start(va,n);
9 for(int i=0; i<n; ++i) len += strlen(va_arg(va,char*));
10 va_end(va); char *cp = new char[len+1], *bp = cp; va_start(va,n);
11 for(int i=0; i<n; ++i) for(char*ap=va_arg(va,char*); *ap; *bp++=*ap++);
15 static inline char *cstrdup(const char *cp) {
16 return strcpy(new char[strlen(cp)+1],cp);
20 #define lengthof(ary) ((int)(sizeof(ary)/sizeof(ary[0])))