views:

206

answers:

2

Quick and simple question.

There are examples online about achieving in-memory gzip compression with zlib (C++) WITHOUT external libraries (like boost or such)?

I just need to compress and decompress a block of data without much options. (it must be gzip as its the same format used by another mine C# program (the data is to be shared))

Tried to search to no avail... Thanks!

+2  A: 

You use an external library called zlib. You could statically link against this library if you did not want to bundle the DLL with your program.

zlib works happily with in-memory buffers.

You do not require boost.

Will
+2  A: 

This isn't a complete answer to your question, but you will probably be interested in How can I decompress a gzip stream with zlib?. There is a little bit of poorly documented magic that you need to supply in order for zlib to work with gzip streams.

The zlib API has many functions for doing in-memory compression that don't depend on actual files on disk.

Greg Hewgill