changin output file name
I'm trying to write a program for class (yes, I'm just learning programming:)) and I need to get a string input, then produce an output text file with that name. I know how to write output to text files, but I can't figure out how I can get the value of a string variable to be the name of the text file, therefore producing a new file each time a new name is entered. The problem for me is the fact that the filename is in double quotes "example.txt", so I can't substitute the variable name in. Any help is appreciated. Thanks.
char more = 'y';
while(more == 'y')
cout << "enter new file name with extents----xxxxx.eee" << endl;
cin >> filename;
fout << "ha ha" << endl;
cout << "more? y/n)
cin >> more;
the parameter for streams is a c_style string or object that can be converted into c_style string "automatically" like a literal string (string in double quotes) or instance of string class from STL.
Thanks for the quick reply, appreciate your help (and yes, it worked, but you knew that already).