Steve
Steve

Reputation: 6424

Most straightforward way of inflating gzip memory stream

I have a gzipped file that I need to read and decompress in my application. I just read through the zlib manual, and it appears that the zlib function are able to operate via memory buffers, but the gzip interface is all file-based.

What is the most common method of dealing with gzipped files like this? Do I need to handle the gzip file format myself, pull out the deflated data, and pass it to the zlib functions?

Note: The reason file-based will not work is because the file is in an archive on a read-only medium, so I can't extract the file first and use the gzip functions from zlib. This is an embedded Linux system.

Upvotes: 0

Views: 271

Answers (1)

Mark Adler
Mark Adler

Reputation: 112239

You need to "read through" the zlib manual again, this time reading through it. inflateInit2() has an option to decompress gzip streams.

Upvotes: 1

Related Questions