Boost logo

Boost Users :

Subject: Re: [Boost-users] [iostreams] Flushing problems with :filtering_ostream
From: eg (egoots_at_[hidden])
Date: 2011-05-02 12:06:24


On 4/23/2011 1:16 PM, Bo Jensen wrote:
> On Fri, Apr 22, 2011 at 10:55 PM, eg<egoots_at_[hidden]> wrote:

>
> /* Typedef */
> typedef boost::iostreams::code_converter<gzip_sink> convert_to_narrow_sink;
>
> int main(int argc, char *argv[])
> {
> std::ofstream strm("test.gz");
>
> gzip_sink gzip(strm);
> convert_to_narrow_sink convert(gzip);
>
> boost::iostreams::filtering_wostreambuf wbuf(convert,100);
>
> std::wostream wout(&wbuf);
>
> wout<<"Hello world!"<< std::endl;
> }
>
>
> I hope someone can make it flush correctly or say I made a simple mistake..

In the interest of closure, can you confirm (from the comment you made
in another thread), that this now works for you after changing the
stream open call to be:

std::ofstream strm("test.gz", std::ios_base::out | std::ios_base::binary);

I know that it works for me when I tried it.


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