xxxxxxxxxx
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main()
{
char *ret;
char *a = "Hello";
char *b = "World";
int c = 123;
int numbytes;
numbytes = sprintf((char *)NULL, "%s %d %s!", a, c, b);
printf("numbytes = %d", numbytes);
ret = (char *)malloc((numbytes + 1) * sizeof(char));
sprintf(ret, "%s %d %s!", a, c, b);
printf("ret = >%s<\n", ret);
free(ret);
return 0;
}