zlib uncompress a .zip file

1.3k views Asked by At

So I have an array of bytes that I would like to decompress using the uncompress function in zlib but it always returns Z_DATA_ERROR. So my question is, does zlib support .zip files?

code:

const unsigned char zip [] = { /*some bytes*/};
unsigned char* decompressed = new unsigned char[decompressedSize];
unsigned char* compressed = new unsigned char[zipSize];
int result = uncompress(decompressed, &decompressedSize, zip, zipSize);
1

There are 1 answers

0
Erix On BEST ANSWER

From faq

Can zlib handle .zip archives?

Not by itself, no. See the directory contrib/minizip in the zlib distribution.

see: http://www.zlib.net/zlib_faq.html#faq11