if i open a file ouput using ofstream it's openmode is set to ios::out and ios::trunc...

what I have to do, if I want to have only the ios::out flag...not the ios::trunc flag.Because, it is deleting all the previous contents.

How do i undo this flag?or, what to do, if I want to remove it, at the moment of initialization?

Specify std::ios::ate as the file mode in the constructor.

Or if the file is already open, close it and reopen with std::ios::ate as the file mode.

Thanks.But I wanted to remove the flag because, i want to take the pointers at the start of the file by reopening it.None of the above solutions do it.

seekp & seekg should get the job dont.But they are not working. :(

I assume this belongs to you.


I have tried with clear and ios::beg combination...results are pretty weird...

so, i have decided to try another way around...i will post update today.

This question has already been answered. Start a new discussion instead.