473,324 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Gzip decompression without saving data to file.

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
2 7875
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Phil | last post by:
At present I use the following to read a text file ... private BufferedReader in = null; ... try { in = new BufferedReader(new FileReader(Filename)); while((line = in.readLine()) != null)...
3
by: rohisingh | last post by:
I have a tar file. The content of the file are as following. rohits@sandman 12-08-04 $ tar tvf 20041208.tar drwxr-xr-x root/root 0 2004-12-08 21:39:19 20041208/ -rw-r--r-- root/root ...
10
by: Xah Lee | last post by:
today i need to use Python to decompress gzip files. since i'm familiar with Python doc and have 10 years of computing experience with 4 years in unix admin and perl, i have quickly located the...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30...
14
by: Bill | last post by:
I've written a small program that, in part, reads in a file and parses it. Sometimes, the file is gzipped. The code that I use to get the file object is like so: if filename.endswith(".gz"):...
0
by: jimmyfingers | last post by:
I've just tried the following code for decompressing a .zip file, but get the following error message: "The magic number in GZip header is not correct. Make sure you are passing in a GZip stream."...
9
by: Rajarshi | last post by:
Hi, I have some code that takes a string and obtains a compressed version using zlib.compress Does anybody know how I can remove the header portion of the compressed bytes, such that I only have...
4
by: mathieu | last post by:
Hello, Browsing the archive of this group I see that the c++ iostream wrapper that are shipped with zlib are not satisfying : ...
3
by: Sean Davis | last post by:
I have a set of numpy arrays which I would like to save to a gzip file. Here is an example without gzip: b=numpy.ones(1000000,dtype=numpy.uint8) a=numpy.zeros(1000000,dtype=numpy.uint8) fd =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.