cout << "What name would you like fo you output file?\n";
getline(cin, file);
outfile.open(file.c_str());
This works fine but I need save my file be save as .txt
format
cout << "What name would you like fo you output file?\n";
getline(cin, file);
outfile.open(file.c_str());
This works fine but I need save my file be save as .txt
format
string ext = ".txt"; //file extension
cout << "What name would you like for your output file?\n";
getline(cin, file);
//highly recommend checking user input (for extensions, invalid symbols etc..)
file += ext; //appends ext to file
outfile.open(file.c_str());
see http://www.cplusplus.com/reference/string/string/ for other operations allowed on std::string