Boost logo

Boost Users :

Subject: [Boost-users] [iostreams] Is it possible to use gzip compression with wide char
From: Bo Jensen (jensen.bo_at_[hidden])
Date: 2010-03-21 03:18:41


Hi,

I am new to boost::iostream and trying to make a simple example of
iostream filtering with gzip compression for wide char, see example
below. It seems there is no support in the gzip wrapper for wide char.
How can I make it reading from a wide char stream ?

Regards
Bo

#include <iostream>
#include <ostream>
#include <sstream>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/config/warning_disable.hpp>

#include <fstream>

int main()
{
    using namespace std;
    namespace io = boost::iostreams;

    {
      io::filtering_wostream out;

      //out.push(boost::iostreams::gzip_compressor()); // Error
      out.push(boost::iostreams::wfile_sink("text.gz"));
      out << 123 << endl;
      wcout <<"Done writing" << endl;
    }
    {
      io::filtering_wistream in;
      //in.push(boost::iostreams::gzip_decompressor()); // Error
      in.push(boost::iostreams::wfile_source("text.gz"));
      wcout << in.rdbuf() << endl;
      wcout <<"Done reading"<< endl;
    }
}


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