user3735796
user3735796

Reputation: 211

How to overwrite a file after already open?

I'm having the following problem:

my program opens a file and copy all its content to a vector. After that, i need to get back to the beginning of the file and rewrite the content in another order.

I tried using clear and seekp, but it didn't work. Can anyone help me please?

This is the code:

first_index is the file I'm working with:

first_index.clear();
first_index.seekp (0, ios_base::beg);

Upvotes: 0

Views: 71

Answers (0)

Related Questions