I guess I'm not even sure if you can do this, but I have no idea why you couldn't. I am trying to use a string variable as the name of a file, but to no avail. My code will not even compile, and I've no idea why.
{ofstream output;
string filename=" ";
cout<<"Specify the name you would like to save the file as with the extension .txt. ";
cin>>filename;
output.open(filename,ios::out);
}
I've also tried getline(cin, filename); instead, but they both give me the same error:
"no matching function for call."
Maybe there's a glaring error that I'm just missing. Thanks! :)