Boost logo

Boost Users :

From: Andreas Masur (amasur_at_[hidden])
Date: 2008-08-22 09:24:42


On Aug 22, 2008, at 9:09 AM, Sachin Garg wrote:

> I have a program which opens a boost fstream in binary input+output
> mode, creating the file if it doesn't exists. But writing doesn't
> works after reading, it must be something obvious that I am not aware
> f. filename is a wpath.

<snip>

You most likely just need to reset the state of the stream. Once you
reach EOF the corresponding flag is set accordingly and thus any
further read/write operation will fail. Add a

f.clear();

between the read and write statements and you should be fine. You may
also need/want to adjust the position marker of the stream by using
'seekg()' accordingly.

Ciao, Andreas


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net