0

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);
bhzag
  • 2,932
  • 7
  • 23
  • 39
  • Zlib implements the [LZW compression](http://en.wikipedia.org/wiki/Lempel–Ziv–Welch) method, but it doesn't handle zip files. Zip is a file format. – tadman Jun 08 '15 at 19:53

1 Answers1

2

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

Erix
  • 7,059
  • 2
  • 35
  • 61