Sample code for 30+ languages & platforms
Unicode C

Transition from Zip.FirstMatchingEntry to Zip.EntryMatching

Provides instructions for replacing deprecated FirstMatchingEntry method calls with EntryMatching.

Chilkat Unicode C Downloads

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

void ChilkatSample(void)
    {
    BOOL success;
    HCkZipW zip;
    const wchar_t *pattern;
    HCkZipEntryW entryObj;
    HCkZipEntryW ze;

    success = FALSE;

    zip = CkZipW_Create();

    //  ...
    //  ...
    pattern = L"*.txt";

    //  ------------------------------------------------------------------------
    //  The FirstMatchingEntry method is deprecated:

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

    //  ...
    //  ...

    CkZipEntryW_Dispose(entryObj);

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

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



    CkZipW_Dispose(zip);
    CkZipEntryW_Dispose(ze);

    }