zlib APIs usage problem in C++ program

N

nagrik

Hello Group,

I am writing a http client and reading a web page from the server. The
page can be compressed in any
of the format namely; gzip or deflate or compress. My client reads the
page in chunks from the socket
and then passes on the decompressed data to the user.

I am makeing use of zlib APIs to decompress the data read from the
server.

The problem I am having is that these APIs can only compress the data
if it is in a file,, whereas my
requirement is to decompress the data from the buffer.

Can someone tell me with a better solution or must I first put the read
data from socket into the file and
then decompress data by using the zlib APIs.

Thx.

nagrik
 
T

Thomas J. Gritzan

nagrik said:
Hello Group,

I am writing a http client and reading a web page from the server. The
page can be compressed in any
of the format namely; gzip or deflate or compress. My client reads the
page in chunks from the socket
and then passes on the decompressed data to the user.

I am makeing use of zlib APIs to decompress the data read from the
server.

Third party libraries are offtopic in this group.
The problem I am having is that these APIs can only compress the data
if it is in a file,, whereas my
requirement is to decompress the data from the buffer.

Not true. The zlib can work on buffers. Look at these functions:

deflateInit, deflate, inflateInit, inflate

If you have questions about these, you have to ask in another place.

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top