Can someone tell me how do I overwrite the first data on the text file? What function do I have to use? I have tried to use the ios::beg but there was an error with it.. Why can I not do like this?
Correct me if I am wrong, ios::trunc and ios::out will delete all the data in the text file. Is it?
I am sorry for not being clear in here. I only want to overwrite the first data in the text file without altering other data.
(What I mean data here is a list of data)
Basically that is the idea. By the way, I find a way to overwrite the first data,
are.open("student_data.txt",ios::in);
are.seekp(0,ios::beg); //overwrite only the beginning of the list (1st data)
Then the second problem is I need to figure out how to overwrite the second data on the list without affecting the rest of the data again. Any idea how? I am trying to do the 'for' loop, but I don't think it make sense.