How compress data in memory buffer by using libbz2 library in C program

半城伤御伤魂 提交于 2019-12-04 02:13:16

问题


I try to compress memory data by using libbz2 library in C program.

Should I use this function of libbz2?:

int BZ2_bzCompress ( bz_stream *strm, int action );

Can anyone show me an example?

Thank you.


回答1:


http://www.bzip.org/1.0.3/html/util-fns.html

Use BZ2_bzBuffToBuffCompress() and BZ2_bzBuffToBuffDecompress() for simple paired compress/decompress.

This page describes the meaning of the last 3 parms: http://www.bzip.org/1.0.3/html/low-level.html



来源:https://stackoverflow.com/questions/9577735/how-compress-data-in-memory-buffer-by-using-libbz2-library-in-c-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!