Sample code for 30+ languages & platforms
Unicode C

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkZipW.h>
#include <C_CkZipEntryW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkZipW zip;
    HCkZipEntryW entry;
    BOOL finished;
    HCkZipEntryW next;
    HCkZipEntryW ze;
    BOOL entryValid;

    success = FALSE;

    //  ------------------------------------------------------------------------
    //  The NextEntry method is deprecated.
    //  See below or code showing how to rewrite using EntryAt/GetNext

    zip = CkZipW_Create();

    success = CkZipW_OpenZip(zip,L"qa_data/zips/xml_files.zip");
    if (success != TRUE) {
        wprintf(L"%s\n",CkZipW_lastErrorText(zip));
        CkZipW_Dispose(zip);
        return;
    }

    entry = CkZipW_FirstEntry(zip);
    if (CkZipW_getLastMethodSuccess(zip) == FALSE) {
        wprintf(L"This zip archive is empty.\n");
        CkZipW_Dispose(zip);
        return;
    }

    finished = FALSE;
    while (finished == FALSE) {

        if (CkZipEntryW_getIsDirectory(entry) == FALSE) {
            wprintf(L"%s\n",CkZipEntryW_fileName(entry));
        }
        else {
            wprintf(L"(directory) %s\n",CkZipEntryW_fileName(entry));
        }

        next = CkZipEntryW_NextEntry(entry);
        if (CkZipEntryW_getLastMethodSuccess(entry) == FALSE) {
            finished = TRUE;
        }

        CkZipEntryW_Dispose(entry);
        entry = next;
    }

    CkZipW_CloseZip(zip);

    wprintf(L"----\n");

    //  ------------------------------------------------------------------------
    //  Do the equivalent using EntryAt/GetNext.

    success = CkZipW_OpenZip(zip,L"qa_data/zips/xml_files.zip");

    ze = CkZipEntryW_Create();
    CkZipW_EntryAt(zip,0,ze);

    entryValid = TRUE;
    while (entryValid == TRUE) {

        if (CkZipEntryW_getIsDirectory(ze) == FALSE) {
            wprintf(L"%s\n",CkZipEntryW_fileName(ze));
        }
        else {
            wprintf(L"(directory) %s\n",CkZipEntryW_fileName(ze));
        }

        entryValid = CkZipEntryW_GetNext(ze);
    }

    CkZipW_CloseZip(zip);


    CkZipW_Dispose(zip);
    CkZipEntryW_Dispose(ze);

    }