Q:

file compression using zlib

Can i use the zlib library function to compress files. I try to do a file compression using "gzopen()" which is actually working with single file with some problems. When i try to decompress the output file using "WinZip" the file extension is not present in the output. For eg. If I compress a file named "test.pdf", the output file name is coming as "test". (the file content is proper. only problem is with the extension)  
     fi = (gzFile *)gzopen(destfile,"ab");
     gzwrite(fi,buff,bufflen);
     gzclose(fi);

When i try to compress two different file(eg "test.pdf" and "sample.pdf") only one file came after extraction using "WinZip"("test"). How to use the zlip file to compress more than one file. I think the problem is with header information in the compressed file. Can i use zlib to compress files?. 

A:

You can use the -N or --name option to gzip to have it use the filename stored in the gzip file instead of the name of the gzip file.
You cannot use gzip by itself to store multiple files.  For a Windows application, I would recommend libzip for multiple files, which encodes and decodes .zip files.  libzip uses zlib for the compression and decompression part.

