Boost logo

Boost Users :

From: David White (dave_at_[hidden])
Date: 2008-03-30 18:47:48


Hi everyone,

I'm using gzip_decompressor in a manner similar to the example program
found at the bottom of
http://boost.org/doc/libs/1_35_0/libs/iostreams/doc/classes/gzip.html .

It mostly works well, however there is a feature of the standard Unix
gzip(1) program that it doesn't seem to emulate: gzip allows one to
concatenate gzipped files together, and when one uncompresses the
resulting file it will be identical to if the two uncompressed files had
been concatenated.

That is to say, one can do this:

$ echo "abc" > a
$ echo "def" > b
$ gzip a
$ gzip b
$ cat a.gz b.gz > c.gz
$ gunzip -c c.gz
abc
def
$

However, using this Boost code:

    ifstream file("c.gz", ios_base::in | ios_base::binary);
    filtering_streambuf<input> in;
    in.push(gzip_decompressor());
    in.push(file);
    boost::iostreams::copy(in, cout);

Will result only in the first line, "abc" being output.

Is there any easy way to emulate the behavior of gzip(1) in this regard?

Any help is appreciated.

David


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