Boost logo

Boost Users :

Subject: Re: [Boost-users] Read/write with gzip
From: eg (egoots_at_[hidden])
Date: 2011-04-28 15:59:31


On 4/27/2011 11:05 AM, Anders Knudby wrote:
>
>
> On Wed, Apr 27, 2011 at 12:27 PM, Ted Byers <r.ted.byers_at_[hidden]
> <mailto:r.ted.byers_at_[hidden]>> wrote:
>
>
>
> On Tue, Apr 26, 2011 at 8:54 PM, Anders Knudby <knudby_at_[hidden]
> <mailto:knudby_at_[hidden]>> wrote:
>
>
>
> Is there a reason not to invoke the stream's member function 'close'
> at this point? You are, after all, reopening the same file later in
> your program.
>
> Cheers
>
> Ted
>
>
> Thanks for the help. The problem of writing the file and then trying to
> read it later in the same process is an artefact of my example, in
> reality I have one program to write the files, and another to read them
> again. But the reason I'm not specifically closing the filtering_stream
> is that I don't know how! I thought I could treat it as a normal
> iostream (e.g. using read, write etc.), but the normal closing of an
> iostream - in.close() - doesn't compile. Instead it gives me the
> following error: "error C2039: 'close' : is not a member of
> 'boost::iostreams::filtering_stream<Mode>". I have found a mention
> somewhere that I need to make the filtering_stream 'closeable', but I
> haven't found out how to do that. Any help would be appreciated, I do
> like to close my streams...
>
> In the meantime, I have somehow managed to get my code to work. I'm not
> sure how, but it is definitely related to the closing or not of the
> filtering_stream. If someone has a simple example of how to create and
> then close/destroy a filtering_streambuf that would be great. I can't
> find a single example in the Boost documentation, but maybe I'm just not
> looking in the right place or sufficiently code-literate.
>

I believe I've used reset().

The following thread has some useful responses in it (especially from
the original author Jonathon Turkanis) that explains some of the issues
around flushing):

http://boost.2283326.n4.nabble.com/gzip-compressor-cannot-be-flushed-and-closed-properly-td2576003.html


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