Sample code for 30+ languages & platforms
Unicode C

Transition from Zip.GetEntryByID to Zip.EntryById

Provides instructions for replacing deprecated GetEntryByID method calls with EntryById.

Chilkat Unicode C Downloads

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

void ChilkatSample(void)
    {
    BOOL success;
    HCkZipW zip;
    int id;
    HCkZipEntryW entryObj;
    HCkZipEntryW ze;

    success = FALSE;

    zip = CkZipW_Create();

    //  ...
    //  ...
    id = 123;

    //  ------------------------------------------------------------------------
    //  The GetEntryByID method is deprecated:

    entryObj = CkZipW_GetEntryByID(zip,id);
    if (CkZipW_getLastMethodSuccess(zip) == FALSE) {
        wprintf(L"%s\n",CkZipW_lastErrorText(zip));
        CkZipW_Dispose(zip);
        return;
    }

    //  ...
    //  ...

    CkZipEntryW_Dispose(entryObj);

    //  ------------------------------------------------------------------------
    //  Do the equivalent using EntryById.
    //  Your application creates a new, empty ZipEntry object which is passed 
    //  in the last argument and filled upon success.

    ze = CkZipEntryW_Create();
    success = CkZipW_EntryById(zip,id,ze);
    if (success == FALSE) {
        wprintf(L"%s\n",CkZipW_lastErrorText(zip));
        CkZipW_Dispose(zip);
        CkZipEntryW_Dispose(ze);
        return;
    }



    CkZipW_Dispose(zip);
    CkZipEntryW_Dispose(ze);

    }