Compression Libraries For C++ [closed]

我是研究僧i 提交于 2019-12-30 03:12:30

问题


I was reading about compression in programs and I started to create a new simple project, a zipper (just a zipper, not an unzipper), but I only found zLib, and it's for C. I know that C libraries can be used in C++, but I like to use C++ libraries. Does anyone know a good one to suggest?

Best Regards.


回答1:


Most compression libraries that I know of are written in C for two reasons: one, the general age of good compression algorithms; and two, the high portability (and stability) of C across platforms.

I suggest any of the following. If you want good licenses select one of the top two, otherwise if you're open to using GPL code pick one of the last two.

  • Bzip2
  • Zlib
  • LZO
  • UCL



回答2:


You could do this easily using Boost iostream zlib filter




回答3:


Zlib is good, but you might want to check the LZMA SDK as well (you could compress to .7z format, in addition to zip)




回答4:


I would suggest using zlib. It is designed for C, but it works fine in C++.

Using native C++ libraries really only helps when the library is sufficiently big and complex that it can benefit from object oriented design. zlib is relatively simple, and doesn't need object oriented features.




回答5:


Use libzip: http://www.nih.at/libzip/ The license is pretty permissive and it does all you need, from C or C++ code.




回答6:


zlib is strongly recommended. It is well written and the interface is fairly clean. I do not see how much a C++ wrapper can simplify APIs. Furthermore, in my view, zlib achieves a good balance between (de)compression speed and file size. Bzip2 is much slower while the compression ratio of LZO and UCL is worse.




回答7:


This what I like (really fast and good compression rate): http://www.quicklz.com/



来源:https://stackoverflow.com/questions/1563700/compression-libraries-for-c

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