用于 C/C++ 的便携式 zip 库(不是应用程序)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/262899/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 14:08:18  来源:igfitidea点击:

portable zip library for C/C++ (not an application)

c++zip

提问by

I want to be able to zip files from my non-gui C/C++ application, on several versions of Windows, Linux/Unix, and MacOS.

我希望能够在多个版本的 Windows、Linux/Unix 和 MacOS 上从我的非 gui C/C++ 应用程序中压缩文件。

The user will compile and run using this app using Eclipse + makefile or VisualStudio. I don't want the user to have to install something separately, or have my makefile install executables.

用户将使用 Eclipse + makefile 或 VisualStudio 使用此应用程序进行编译和运行。我不希望用户必须单独安装某些东西,或者让我的 makefile 安装可执行文件。

Prefer open-source. I'm already looking at "Zip 3.0"...

更喜欢开源。我已经在看“Zip 3.0”了……

回答by Dmitry

Take a look at Libarchive. I spent a lot of time seeking for a cross-platform and LGPL licensed library with convenient interface. This the best of all I've seen. Very easy and powerful tool. Originally designed for Unix-like systems but there's also the Windows version.

看看Libarchive。我花了很多时间寻找具有方便界面的跨平台和 LGPL 许可的库。这是我见过的最好的。非常简单和强大的工具。最初是为类 Unix 系统设计的,但也有 Windows 版本

回答by Homer6

I've had great results with miniz: https://code.google.com/p/miniz/

我使用 miniz 取得了不错的效果:https: //code.google.com/p/miniz/

For a simple compression of strings in c++, I also really like Timo Bingmann's solution.

对于 C++ 中字符串的简单压缩,我也非常喜欢Timo Bingmann 的解决方案

回答by dk123

I'd recommend ZipLib https://bitbucket.org/wbenny/ziplib/wiki/Home

我推荐 ZipLib https://bitbucket.org/wbenny/ziplib/wiki/Home

Personal reasons why I love this project:

我喜欢这个项目的个人原因:

  • built around c++11 stl streams(ex. decompresses into stl streams!)
  • lightweight (no dependencies other than zlib)
  • can be used on both windows & liunx
  • 围绕 c++11 stl 流构建(例如,解压缩为 stl 流!)
  • 轻量级(除了 zlib 没有依赖项)
  • 可以在 windows 和 liunx 上使用

It took me a long time to find this project - hope this helps someone.

我花了很长时间才找到这个项目 - 希望这对某人有所帮助。

回答by Herms

We've used zliba couple times here. It's a fairly standard library that has implementations in most main languages.

我们在这里使用了几次zlib。这是一个相当标准的库,在大多数主要语言中都有实现。

回答by BastiBen

回答by Kris Kumler

Others have mentioned zlib, which is nice and fairly easy.

其他人提到了 zlib,它很好而且相当容易。

The 7-Zip (LZMA) SDKis more complex but also has very nice compression rates.

7-ZIP(LZMA)SDK是比较复杂的,但也有非常不错的压缩率。

Edit:Although still in development, with the release process and history over time, I would be hesitant to recommend this now.

编辑:虽然仍在开发中,但随着时间的推移发布过程和历史,我会犹豫现在推荐这个。

回答by Cheeso

ZLIB - the most portable library in the world. open source, very proven and reliable. The gold standard. why use anything else?

ZLIB - 世界上最便携的图书馆。开源,非常成熟和可靠。黄金标准。为什么要使用其他东西?