How to unzip a zip file already loaded in memory in C?

回眸只為那壹抹淺笑 提交于 2019-12-06 22:26:28

zlib supports in-memory inflate() and deflate() functions. You can read how from here

Take a look at libarchive It supports the zip format.

Example of extracting archive in memory:

struct archive *a = archive_read_new();
archive_read_support_compression_gzip(a);
archive_read_support_format_tar(a);
r = archive_read_open_memory(a, buff, sizeof(buff));

libzip (which is based on zlib) has a function to open an archive from memory. Example code is on github.

src = zip_source_buffer_create(data, size, 1, &error)
za = zip_open_from_source(src, 0, &error)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!