0

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);
Filip Roséen - refp
  • 62,493
  • 20
  • 150
  • 196
user3735796
  • 191
  • 2
  • 2
  • 7
  • 2
    Instead of upvoting the [above comment](http://stackoverflow.com/questions/24194687/how-to-overwrite-a-file-after-already-open#comment37351957_24194687), cast the relevant *close vote* to redirect this post to the other (which already contains the answer). – Filip Roséen - refp Jun 12 '14 at 22:17
  • 1
    Meh I'm only about 70% behind you on that, @FilipRoséen-refp but.. good enough. – Lightness Races in Orbit Jun 12 '14 at 22:19

0 Answers0