By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,203 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,203 IT Pros & Developers. It's quick & easy.

Gzip decompression without saving data to file.

P: n/a
I have tried to search Google, but I cannot seem to find a library to
decompress a gzip string or char to a string or char. I want to write
something that allows libcurl to access a page, save the output to a
string. I do not want to save a page every time I access one.

Jul 16 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 16 Jul 2007 17:37:27 -0000, Chaos <ps*******@gmail.comwrote:
>I have tried to search Google, but I cannot seem to find a library to
decompress a gzip string or char to a string or char.
Have a look here: http://www.zlib.net/zlib_faq.html#faq19
--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
Jul 16 '07 #2

P: n/a
On Jul 16, 7:37 pm, Chaos <psnim2...@gmail.comwrote:
I have tried to search Google, but I cannot seem to find a library to
decompress a gzip string or char to a string or char. I want to write
something that allows libcurl to access a page, save the output to a
string. I do not want to save a page every time I access one.
What does it mean, a "gzip string or char"? Gzip is a file
compression format; you could concevably use it on a string (but
it would have to be a very, very long string for it to make
sense), but certainly not on a single char. Note that gzip is
context sensitive. You cannot extract bytes from somewhere in
the middle of a gzip file, and decompress them, because the
compression algorithm depends on all of the data which came
before it.

If you want to read a gzipped file into your program, without
passing through an intermediate, decompressed file, the simplest
solution is to use a pipebuf---a streambuf which reads to and
writes from a pipe. You then open the pipebuf with something
like pipebuf( "gzip < filename.gz", std::ios::in ), and read as
from a normal file.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 17 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.