Boost logo

Boost Users :

Subject: Re: [Boost-users] [iostreams] How can I use the Stream Insertion operator (<<) with a filtering_streambuf?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-07-31 08:16:20


On 07/30/13 13:59, Larry Evans wrote:
> On 07/29/13 11:27, Larry Evans wrote:
>> On 07/29/13 11:10, Larry Evans wrote:
>> [snip]
>>> BTW, I tried modifying Ken's code to use filtering_ostream instead
>>> of filtering_streambuf, and it worked. I also removed the ios_base
>>> flags and it still worked. Then I tried using stringstream instead
>>> of filestream and it no longer worked. Anyone have any clues about
>>> why stringstream doesn't work? The code is attached. With the
>>> attached code and attached Jamfile.v2, and with:
>>>
>>> #define USE_STRINGSTRM
>>>
>>> in the code, the KenApplebyStrm.output produced by bjam is
>>> in the next attachment.
>>> In contrast, with:
>>> //#define USE_STRINGSTRM
>>> int the code, the KenApplebyStrm.output produced by bjam is
>>> in the last attachment.
>> [snip]
>> OOPS. The code attached previously used streambuf instead of
>> stream. The current attachment uses stream.
>
> Based on running the attached both with:
>
> #define USE_FILT_COMPRESS
>
> then with:
>
> //#define USE_FILT_COMPRESS
>
> on line 40 showed that using the gzip_decompressor starts reading
> at the end of the stream instead of at the beginning.
>
> The corresponding outputs are also attached.
>
> This contrasts with the count filter which starts reading, as one
> would expect, at the beginning of the stream.
>
> Still trying to track down why.
>
Changing the:

  out.flush()

around line 93 to:

  out.strict_sync();

which is described here:

http://www.boost.org/doc/libs/1_54_0/libs/iostreams/doc/classes/filtering_stream.html#sync

failed to solve problem :(
Still trying to track down why.

-regards,
Larry


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