I didn't say I was confused. I was asking how I can ask for the user to input the file he wants to append to instead of just hardcoding it to work for 1 file.
I also wanted to know why my loop wasn't working and you answered that I think.
Also about making an option for the user to tell me whether they wanted to read or write to their file and how I go about them going into one of those modes.
I didn't say I was confused. I was asking how I can ask for the user to input the file he wants to append to instead of just hardcoding it to work for 1 file.
Well, then I am confused why you are still asking.
cppnoob25 wrote:
I also wanted to know why my loop wasn't working and you answered that I think.
Review the looping structures and choose either the while-loop or the for-loop - you can't mix them ;)
cppnoob25 wrote:
Also about making an option for the user to tell me whether they wanted to read or write to their file and how I go about them going into one of those modes.
If you use std::fstream, then you can read or write depending on whether you specify std::ios::out or std::ios::in as one of the flags. You can specify both, but it's not recommended to do so.
Ok I am confused then. I know I ask the user in my code but it doesn't matter what the user inputs because the file that my code reads and writes to is just "file.txt". I don't know how to put the users input into ofstream.
Something obvious to you isn't obvious to me ha.
Thanks for the other info I will review it and come back to that.
dude put your code back, it might help someone with a similar problem.
I'm wondering whether it's legitimate to report people who do this? It's utterly selfish - the OP has gotten what they want, but they're not prepared to leave their code as a lasting contribution to this community in return.
I would say do report it, as it actually subtracts from the forum because now someone has to see this and find out that they wasted their time and then continue searching.
I will return the code and I didn't think it was a big deal. For some reason I don't get email updates or my code would have been up a lot earlier.
I didn't remove it with the intention of being selfish but merely because I think the people who take time to actually register to this website to ask about their code are here to learn. As opposed to someone just looking for answers without putting much thought into it.