Tag: zlib

使用zLib进行错误缩放和膨胀

我正在尝试使用gcc在我的Linux(Ubuntu 8.04)中编译zpipe.c示例,但是我遇到了一些错误,请看一下: [ubuntu@eeepc:~/Desktop] gcc zpipe.c /tmp/ccczEQxz.o: In function `def’: zpipe.c:(.text+0x65): undefined reference to `deflateInit_’ zpipe.c:(.text+0xd3): undefined reference to `deflateEnd’ zpipe.c:(.text+0x150): undefined reference to `deflate’ zpipe.c:(.text+0x1e8): undefined reference to `deflateEnd’ zpipe.c:(.text+0x27b): undefined reference to `deflateEnd’ /tmp/ccczEQxz.o: In function `inf’: zpipe.c:(.text+0x314): undefined reference to `inflateInit_’ zpipe.c:(.text+0x382): undefined reference to `inflateEnd’ zpipe.c:(.text+0x3d7): undefined reference to `inflate’ zpipe.c:(.text+0x44b): undefined […]

使用zlib解压缩zip文件

我有一个archive.zip,其中包含两个加密的“.txt”文件。 我想解压缩存档以检索这2个文件。 这是我到目前为止所做的: FILE *FileIn = fopen(“./archive.zip”, “rb”); if (FileIn) printf(“file opened\n”); else printf(“unable to open file\n”); fseek(FileIn, 0, SEEK_END); unsigned long FileInSize = ftell(FileIn); printf(“size of input compressed file : %u\n”, FileInSize); void *CompDataBuff = malloc(FileInSize); void *UnCompDataBuff = NULL; int fd = open (“archive.zip”, O_RDONLY); CompDataBuff = mmap(NULL, FileInSize, PROT_READ | PROT_WRITE, MAP_PRIVATE, […]

使用zlib的gzip文件访问function解压缩文件大小

使用linux命令行工具gzip我可以使用gzip -l告诉压缩文件的未压缩大小。 我在zlib手册部分“gzip文件访问function”中找不到任何类似的function。 在这个链接上,我找到了一个解决方案http://www.abeel.be/content/determine-uncompressed-size-gzip-file ,它涉及读取文件的最后4个字节,但我现在正在避免它,因为我更喜欢使用lib的function。

如何检查文件是否被gzip压缩?

我有一个C / C ++程序需要读取一个文件,该文件可能是也可能不是gzip压缩的。 我知道我们可以使用zlib中的gzread()来读取压缩文件和未压缩文件 – 但是,如果文件是gzip压缩的,我只想使用zlib函数(出于性能原因)。 那么有什么方法可以以编程方式检测或检查某个文件是否是从C / C ++中解压缩的?

我如何使用Minizip(在Zlib上)?

我正在尝试为跨平台应用程序存档文件,看起来像Minizip(基于zlib构建)就像归档程序一样可移植。 但是,当我尝试运行以下虚拟代码时,我收到系统错误[my executable] has stopped working. Windows can check online for a solution to the problem. [my executable] has stopped working. Windows can check online for a solution to the problem. 任何人都可以帮我看看如何使用这个库? – (我找不到任何文档或教程) zip_fileinfo zfi; int main() { zipFile zf = zipOpen(“myarch.zip”,APPEND_STATUS_ADDINZIP); int ret = zipOpenNewFileInZip(zf, “myfile.txt”, &zfi, NULL, 0, NULL, 0, “my comment […]