Compression is not working in ZLib library

367 views Asked by At

I want to zip a already existing file in a directory, I am calling deflate method

int def(FILE *source, FILE *dest, int level) of ZLib library and I'm getting zipped file (making a file with .zip extension), but the problem is when I'm trying to unzip it by double clicking, I'm getting corrupted file though the return value is Z_OK.

PS: want to compress file not data. Any Help???

1

There are 1 answers

4
Mark Adler On

zlib does not produce the zip format. You would need to generate your own zip headers and trailers around the deflate compressed data produced by zlib.