24.5 oegzstream

These classes, oeigzstream and oeogzstream, are wrapper classes for other oestream classes. These classes provide dynamic compression and decompression of data using zlib.

oeifstream ifs;
oeofstream ofs;

ifs.open("input.txt.gz");
ofs.open("output.txt.gz");

if (ifs && ofs)
{
    oeigzstream igzs(&ifs, false);
    oeogzstream ogzs(&ofs, false);

    std::string buffer;
    while (igzs && ogzs)
    {
        if (igzs.getline(buffer))
            ogzs << buffer;
    }

    igzs.close();
    ogzs.close();
}

ifs.close();
ofs.close();