开发者

Zip directory in C++

How can I zip directory in C++. I read this question: How do I zip a directory of files using C++? But I'd prefer a way that uses something like gzip, z开发者_C百科lib and boost(because I do not want to add new libs to the project). Winapi-way is also acceptable (if it exists). And I do not want to start new process.

I would like a code sample. Thanks in advance


You want zip but you don't want to use any libraires?

Do you want to be bound by a particular licence - if so then simply copy all the code from zlib and the zip add-on into your own code.

If you can't use their licence then get the specs and write your own clean room implementation - make sure that you haven't seen the zlib or zip code base though.

The other alternative is to bundle a freely available zip command line client and call it with a system() call

edit: if you mean you are already using zlib then minizip does the directory stuff - it's usually included with zlib in the contrib directory


You can use boost iostream which includes compression functionalities. Have a look at the documentation here: http://www.boost.org/doc/libs/1_46_1/libs/iostreams/doc/index.html

It seems that in fact in this case that won't work for a directory of files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜