/* need to include MAXMIN_MAC.H for MIN() and STRING.H for STRNCPY() */ #define MAX_CHAR 100 /* number of chars in the longest string */ static char tempS[MAX_CHAR+1]; /* +1 for terminal '\0' */ static const char *tempA, *tempB; #define STRCAT(a,b) \ ( tempA = a, tempB = b, \ strncpy(tempS, tempA, MIN(MAX_CHAR, strlen(tempA))), \ strncpy(tempS + strlen(tempA), tempB, \ MIN(MAX_CHAR-strlen(tempA), strlen(tempB)+1)), \ tempS \ )