deflate and inflate (zlib.h) in C

后端 未结 3 610
南方客
南方客 2020-12-28 09:53

I am trying to implement the zlib.h deflate and inflate functions to compress and decompress a char array (not a file).

I would like to know if the following syntax

3条回答
  •  一生所求
    2020-12-28 10:54

    The zpipe example (http://zlib.net/zpipe.c) pretty much covers it, just remove the file ops(the f prefixed function), and you replace in and out with your in-memory buffers, though it may be enough to only replace in or keep the buffers as-is depending on you usage. Just note that you will need to make your out buffer resizeable to account for decompression of arbitrarily sized data, if you are planning on having unknown sized chunks

提交回复
热议问题