fstream file variable?
Is there a way to have the user specify what he wants the file to be called that he is creating and appending to? For example...
cout << "file name?\n";
cin >> filename;
but instead of "filename.txt" it has whatever the user typed in and then ".txt" Thanks.
Have you tried this:
Well I'll be.. Thanks man..but how do I get a .txt at the end of that baby on the same line?
EDIT: I concactinated (however you spell that word) it with another string with a value of ".txt" It worked but im hoping i can add it on the same line as the variable.
Last edited by andy3109; May 14th, 2003 at 06:01 PM.
filename += ".txt";
blah.open(string(filename + ".txt").c_str(), ios::app);
blah.open((filename + ".txt").c_str(), ios::app);
Take your pick!
scorp..have I ever told you i loved you? (in a non-gay way)