This works fine!. Thanks Oliver! El miércoles, 30 de enero de 2013 14:27:38 UTC+1, Oliver escribió: > > On Wed, Jan 30, 2013 at 12:45 PM, David Granados > <[email protected]<javascript:> > > wrote: > >> >> > If i write the size and is 192, compress does not work. >> > > In the code you attached, you are writing the *uncompressed* size to cout: > > std::cout << gzip_stream.ByteCount()<<std::endl; > > > GzipOutputStream::ByteCount() returns the number of uncompressed bytes > written *to* the stream, not the number of compressed bytes that were > written to the underlying stream. If you want to count the compressed > bytes, call ByteCount() on the underlying stream. (i.e. output->ByteCount() > in your code) > > Also, if you want to eventually end up with a std::string containing the > compressed output, why don't you use StringOutputStream? Something like > this (untested): > > { > StringOutputStream compressedStream(&outputString); > GzipOutputStream compressingStream(compressedStream, options); > pProto.SerializeToZeroCopyStream(&compressingStream); // error checks > omitted for brevity > // let destructors do stream cleanup > } > > Oliver > >
-- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
