From: Andrea Arteaga on
I'm writing a C++ library for data exchange between C++ and Matlab through MAT files. Now, Matlab compresses the data using zlib before writing it to the file. When I open the file with C++, I can read the information about the size of the compressed data, but I also need the information about the decompressed size, since I have to allocate enough memory.

[url=http://www.zlib.net/manual.html]From zlib manual[/url]: "The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library."

How can I have this information?
From: Chris Hulbert on
On Apr 27, 5:17 am, Andrea Arteaga <andyspi...(a)gmail.com> wrote:
> I'm writing a C++ library for data exchange between C++ and Matlab through MAT files. Now, Matlab compresses the data using zlib before writing it to the file. When I open the file with C++, I can read the information about the size of the compressed data, but I also need the information about the decompressed size, since I have to allocate enough memory.
>
> [url=http://www.zlib.net/manual.html]From zlib manual[/url]: "The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library."
>
> How can I have this information?

You have to inflate the variable header and figure out the size from
the data type and dimensions.

Chris