You should use inflate()
, not uncompress()
. In inflateInit2()
, you can specify the gzip format (or auto-detection of the zlib or gzip format). See the documentation in zlib.h.
You can take the source code for uncompress()
in zlib and make a simple change to use inflateInit2()
instead of inflateInit()
to create your own gzipuncompress()
, or whatever you'd like to call it.