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