Ben
Ben

Reputation: 673

Standardized library to compress data as a sequence of small pieces C++/C?

I need to compress data for logging by appending short strings to the log file using C++/C. I first tired gzip(zlib), but this makes a symbol table for each short string and actually makes the data longer rather than compressing. I believe the thing I'm looking for is a static Huffman table. Anyway, I was wondering if there was a common algorithm for this. I would much rather a format that anyone could read. I think the answer is no, but this is the place to ask. Thanks.

Upvotes: 1

Views: 274

Answers (1)

Mark Adler
Mark Adler

Reputation: 112239

You should look at the examples/gzlog.[ch] source files in the zlib distribution. That code was written for precisely this purpose. It appends short strings to a growing compressed gzip file.

Upvotes: 1

Related Questions