The first problem is due to filename being a char* instead of a const char*. The second problem is due to you attempting to concatenate "rpg" to filename, but such concatenation using operator+ only works (correctly) on std::string. As such, just write:
Code:
std::string filename;
// ...
cin >> filename;
filename += "rpg";
std::ofstream output(filename.c_str());
Alternatively, you can write:
Code:
std::ofstream output((filename + "rpg").c_str());
But it may be better to concatenate the "rpg" to the string if you should need to reuse the filename, e.g., to show the user what file was opened.