Store all data from vector into a file

I recently created code to show and edit data from a text file.
But the problem is how to store the edited data in the existing text file.
The old data has to be overwritten, and the new data has to be stored in the text file so it can be opened by notepad(or any ascii-editor.
At first i have to open the file, and then store the data.
I started with:

1
2
for (int i= 0; i < number; i++)
write_to_file (struct_vector [i], .....); 


But how can i store the data and overwrite the old data?
http://www.cplusplus.com/reference/iostream/ofstream/open/
I'd use ios::trunc and then the rest is up to you ;)
Topic archived. No new replies allowed.