After opening a data and edit. I want to \"SAVE AS\" the data with different nam
ID: 3650567 • Letter: A
Question
After opening a data and edit. I want to "SAVE AS" the data with different name and new file.For example if I open "Text.txt" and edit it, then I want to save as new file with the name "Hello.txt". How can I write the code?
Sorry that I can't upload the whole code here since it is homework and I don't want to post my whole homework here >_<
My current code:
string newfile;
ofstream inputFile; // ifstream inputFile already declared.
cout << "Enter new file name: ";
getline(cin, newfile);
inputFile.open(newfile.c_str());
cout << "Document saved with the name " << newfile;
My code doesn't work Lol >_<
Please help, I'll rate 6/5 stars! Thanks a lot.
Explanation / Answer
Take reference from this code: #include #include using namespace std;int main () { string saveload; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.