You could use strrchr to find the last period in the filename. Then you know what the filename is minus the extension. Next you can then use snprintf or sprintf() to print the filename portion to a new string with _out.txt appended, like so:
Code:
char * sbuf;
size_t over, sz = 10;
sbuf = malloc(sizeof *sbuf * sz);
if ((over = snprintf(sbuf, sz, "%s_out.txt", orig_file)) >= sz) {
sbuf = realloc(sbuf, sz+over); /* should use a tmp buffer here and error check */
snprintf(sbuf, sz, "%s_out.txt", orig_file);
}