Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2005-11-14 19:35:59


Hi there I just have a simple question regarding the format of a zlib
archive. Somehow WinRar cannot read the archive. If I use the simple
example application provided in the zlib distribution WinRar is able
to read it. This makes me wondering what difference is in the archive
generated by boost::iostreams?

Here is my example code which works fine. I using VC7.1 and Boost 1.33

#include <iostream>

#define BOOST_IOSTREAMS_NO_LIB

#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/zlib.hpp>

namespace io = boost::iostreams;

int _tmain(int argc, _TCHAR* argv[])
{
   {
      io::filtering_ostream out;
      out.push( io::zlib_compressor() );
      out.push( io::file_sink( "hello.zip" ));

      out << "Hello boost::iostreams";

      //close the file
   }

   io::filtering_istream in;
   in.push( io::zlib_decompressor() );
   in.push( io::file_source( "hello.zip" ));

   std::string strMessage;

   std::getline( in, strMessage );

   std::cout << strMessage << std::endl;

   return 0;
}

Besides the problem, seems that boost::iostream is an amazing lib and
a huge contribution for the C++ community. Thanks,
Christian


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