Have a look at the strcat function.
In particular, you could try this:
const char* name = "hello";
const char* extension = ".txt";
char* name_with_extension;
name_with_extension = malloc(strlen(name)+1+4); /* make space for the new string (should check the return value ...) */
strcpy(name_with_extension, name); /* copy name into the new var */
strcat(name_with_extension, extension); /* add the extension */
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…