zlib的C ++和提取文件 [英] zlib c++ and extracting files

查看:478
本文介绍了zlib的C ++和提取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用zlib 1.2.5,我没有看到任何程序来从一个zip文件中提取?我读到一minizip应用程序,分发的一部分。

I have started to use zlib 1.2.5 and I do not see any routine to extract from a zip file? I read about a minizip application, part of the distribution.

是如何它应该做些什么呢?

Is that how it is supposed to be done?

推荐答案

是的,它确实很好。 (但是,如果你永远不喜欢C code,你应该看看那些在C code ++和C#的7-Zip SDK)。

Yes, it does it well. (But if ever you don't like C code, you should look at 7-zip SDK that have code in C++ and C#.)


  • 所有的功能浏览和uncom preSS从ZIP文档中的文件在: unzip.h

  • 所有功能融为一体preSS和文件添加到zip归档在: zip.h

  • All the functions to browse and uncompress the files from an zip archive are in: unzip.h
  • All the functions compress and add files to a zip archive are in: zip.h

(看的contrib \\ minizip \\ unzip.h 的contrib \\ minizip \\ zip.h

例如DECOM pressing:
unzOpen() zip文件中的函数返回一个 unzFile

for example decompressing: the unzOpen() functions of your zip file returns a unzFile

然后用 unzGoToFirstFile() unzGoToNextFile()在此 unzFile 通过在归档中的所有文件进行浏览。

then use unzGoToFirstFile() and unzGoToNextFile() on this unzFile to browse through all files in the archive.

那么你得到的每个文件的文件信息与 unzGetCurrentFileInfo(),即它的大小,

then you get the file info for each files with unzGetCurrentFileInfo(), namely for its size,

想必你应该叫 unzOpenCurrentFile()在某一时刻。

surely you should call unzOpenCurrentFile() at some moment.

和呼叫 unzReadCurrentFile()使用从FileInfo的大小,检索归档文件的二进制内容。

and call unzReadCurrentFile() using the size from fileinfo, retrieving the binary content of the archived file.

optionnally,有一个不透明的结构,你可以提供,以便使用自己的I / O功能,但显然是有文件访问默认的Win32实现,所以你甚至可以不用担心。

optionnally, there is an opaque structure you can provide so as to use your own i/o function, but obviously there is a default win32 implementation for file access, so you could even not worry about that.

PS:不要忘记调用unzCloseCurrentFile()

PS: and dont forget to call unzCloseCurrentFile()

这篇关于zlib的C ++和提取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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