
#include <string>
#include <iostream>

int main()
{
    int a = 5;
    std::string filename = "file" + std::to_string(a) + ".txt";

    std::cout << "The filename is: " << filename << std::endl;

    // if you need a const char*:
    const char* ptr = filename.c_str();
    std::cout << "As a pointer:  " << ptr << std::endl;
}
