If you were writing in C, and assuming name is a fixed-length array as you claim, you would have to do something like this:
char filename[sizeof(name) + 4];
strcpy (filename, name) ;
strcat (filename, ".txt") ;
FILE* fp = fopen (filename,...
Do you see why everyone recommends std::string?