+ 2
Save Input to txt file
i used ofstream myFile; myFile.open(filename); cout<<"create a username"<<endl; cin>>username; myFile<< username << endl; I got it to save in the file, but it only saves to the first line, so it overwrite whatever was there. someone help
5 Respostas
+ 2
Try to use the open mode append:
myFile.open("filename", ios::app);
it should open the file to append it so it should not overwrite!
+ 2
I still seem to be having the same problem. I don't think it's a problem with how I'm opening the file, but rather how I'm storing the info
+ 2
It worked ! THANK YOU SO MUCH
+ 1
Try to do like here:
http://www.cplusplus.com/reference/fstream/fstream/open/
0
Glad I could help 😊
Happy coding!