我如何压缩使用C ++文件的目录? [英] How do I zip a directory of files using C++?

查看:186
本文介绍了我如何压缩使用C ++文件的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中使用C ++,升压,和Qt工作。我知道如何COM preSS单个文件和字节流使用,例如,QCOM $ P $(PSS)的Qt的功能。

I'm working on a project using C++, Boost, and Qt. I understand how to compress single files and bytestreams using, for example, the qCompress() function in Qt.

我如何压缩多个文件,包括子目录的目录?我要寻找一个跨平台(苹果机,运,Linux)的解决方案;我想preFER不火一串新的流程。

How do I zip a directory of multiple files, including subdirectories? I am looking for a cross-platform (Mac, Win, Linux) solution; I'd prefer not to fire off a bunch of new processes.

有没有办法从多个文件字节流合并成一个压缩文档的标准方式,或者也许有,将在升压iostream库提供一个方便的函数或方法?

Is there a standard way to combine bytestreams from multiple files into a zipped archive, or maybe there is a convenience function or method that would be available in the Boost iostream library?

为帮助非常感谢。

更新:本QuaZip库看起来真的很棒。有一个在下载包的例子(在测试DIR),显示很清楚如何压缩了文件的目录。

Update: The QuaZip library looks really great. There is an example in the download package (in the "tests" dir) that shows very clearly how to zip up a directory of files.

更新2 :在我的Linux构建环境完成此任务后,我发现QuaZip不与Visual Studio编译器在所有工作。它可能会解决所有的编译器错误,但谨慎的给任何人一个字看下来这条路。

Update 2: After completing this task on my Linux build environment, I discovered that QuaZip doesn't work at all with the Visual Studio compiler. It may be possible to tackle all those compiler errors, but a word of caution to anyone looking down this path.

推荐答案

我发现以下两个库:


  • ZipIOS ++ 。似乎是纯粹的C ++。他们没有明确列出的Windows作为一个支持的平台。所以我觉得你应该自己试试你的运气。

  • QuaZIP 。基于的Qt4。其实看起来不错。他们列出明确的Windows(MinGW的使用)。显然,这是一个C ++包装器[此]库。

  • ZipIOS++. Seems to be "pure" C++. They don't list Windows explicitly as a supported platform. So i think you should try your luck yourself.
  • QuaZIP. Based on Qt4. Actually looks nice. They list Windows explicitly (Using mingw). Apparently, it is a C++ wrapper for [this] library.

嗯,当然,我已经撕开从这个这些网站关于正在压缩/解压缩目录的Qt的邮件列表的问题:)

Ah, and of course, i have ripped those sites from this Qt Mailinglist question about Zipping/Unzipping of directories :)

这篇关于我如何压缩使用C ++文件的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆