Boost logo

Boost Users :

From: Rodrigo Baroni (rodrigobaroni_at_[hidden])
Date: 2005-12-10 23:37:32


Hi all,

         How can I know the size of a stream< io::array_sink >
memoryStream( buffer, size ) , after some operations that has filled
the stream (the memory) ? Is there some way ?

         Example:

//--------------- Compress the content of buffer to
compressedBuffer----------------------

        char buffer = "Helloooo compressed filter example!";
        int SIZE = 10000;

        char compressedBuffer = new char [ SIZE ];

        io::stream< io::array_source > bufferStream( buffer, std::strlen( buffer ) );
        io::stream< io::array_sink > compressedBufferStream( &compressedBuffer, SIZE );

        io::filtering_ostream compressFilterOutput;
        compressFilterOutput.push( io::zlib_compressor( ) );
        compressFilterOutput.push( compressedBufferStream );

        io::copy( bufferStream, compressedFilterOutput );
        compressedBufferStream.flush( );
        compressFilterOutput.reset( );

//-----------------------------

  How can I know the size of the compressedBufferStream, or
compressedBuffer now? std::strlen( compressedBuffer ) gives me wrong
value.

Thanks in advance,
Rodrigo Ferreira Baroni


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