List Archive


Thread Index


From: Aleksey Timin <>
Subject: zip_fopen works with error ZIP_ER_ZLIB on Windows
Date: Tue, 12 Sep 2017 16:15:01 +0000

Hallo everyone,
I have a problem trying to read a ZIP archive by using zip_fopen function:

    auto archive = cip_server.get_archive_name();
    if ((zip_archive = zip_open(archive.c_str(), 0, &err)) == NULL) {
        LOG_ERROR("Error: can't open zip archive.");

    for (uint32_t i = 0; i < zip_get_num_entries(zip_archive, 0); i++) {
        struct zip_stat zip_stat;

        if (zip_stat_index(zip_archive, i, 0, &zip_stat) == 0) {
            LOG_INFO("Start uncompressing archive file");

            struct zip_file *zip_file = zip_fopen(zip_archive,, 0);
            if (zip_file == NULL) {
                zip_error_t* error = zip_get_error(zip_archive);
                LOG_ERROR_FMT("ERROR Zip: can't open uncompress entry in archive: %i",  zip_error_code_zip(error));
                has_error = true;
/* unrelated part of code */

This code shows message `ERROR Zip: can't open uncompress entry in archive: 13` after it has tried to read an entry of the archive. I use it on Linux and don't have any problems. but it doesn't work on Windows at all.
I understand that something wrong with zlib but don't have any ideas what to do.

Thanks for your help!

Made by MHonArc.