Boost logo

Boost Users :

From: Jonathan Turkanis (turkanis_at_[hidden])
Date: 2008-02-27 18:58:04


Jonathan Turkanis wrote:

> What you are noticing is that data is not being written to disk until
> the streams are closed. This is not actually a bug, as I will explain,
> but it still may warrant a change to the library.

Actually, while everything I said is correct if you are using the Boost
trunk, if you are using 1.34.1, the problem is that the dynamically
allocated fstreams are not being closed until their destructors are
called at program termination.

You can fix this by:

i. changing the way you store the ofstreams, so their destructors are
called earlier;
ii. manually closing the ofstreams after you are done writing to them; or
iii. switching to Boost.Iostreams file_sinks or file_descriptor_sinks.

As I mentioned at the end of my last post, if you continue to use
fstreams, you should change the way you store them, since currently they
represent a resource leak.

Best,

-- 
Jonathan Turkanis
CodeRage
http://www.coderage.com

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