![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C) Find a ZIP Entry by EntryID Using EntryByIdSee more Zip Examples This example demonstrates how to use the Each This is useful when:
The example:
Note: This example requires Chilkat v11.0.0 or greater.
#include <C_CkZipW.h> #include <C_CkZipEntryW.h> void ChilkatSample(void) { BOOL success; HCkZipW zip; HCkZipEntryW entry; int entryId; HCkZipEntryW entry2; success = FALSE; success = FALSE; // Open an existing ZIP archive. zip = CkZipW_Create(); success = CkZipW_OpenZip(zip,L"example.zip"); if (success == FALSE) { wprintf(L"%s\n",CkZipW_lastErrorText(zip)); CkZipW_Dispose(zip); return; } // Retrieve the first entry in the ZIP archive. entry = CkZipEntryW_Create(); success = CkZipW_EntryAt(zip,0,entry); if (success == FALSE) { wprintf(L"%s\n",CkZipW_lastErrorText(zip)); CkZipW_Dispose(zip); CkZipEntryW_Dispose(entry); return; } wprintf(L"Original entry:\n"); wprintf(L" FileName: %s\n",CkZipEntryW_fileName(entry)); wprintf(L" EntryID: %d\n",CkZipEntryW_getEntryID(entry)); wprintf(L"\n"); // Save the EntryID for later use. entryId = CkZipEntryW_getEntryID(entry); // Create another ZipEntry object. entry2 = CkZipEntryW_Create(); // Retrieve the same entry using EntryById. success = CkZipW_EntryById(zip,entryId,entry2); if (success == FALSE) { wprintf(L"%s\n",CkZipW_lastErrorText(zip)); CkZipW_Dispose(zip); CkZipEntryW_Dispose(entry); CkZipEntryW_Dispose(entry2); return; } wprintf(L"Entry retrieved by EntryID:\n"); wprintf(L" FileName: %s\n",CkZipEntryW_fileName(entry2)); wprintf(L" EntryID: %d\n",CkZipEntryW_getEntryID(entry2)); wprintf(L"\n"); // The filenames and EntryID values should match. CkZipW_CloseZip(zip); wprintf(L"Done.\n"); CkZipW_Dispose(zip); CkZipEntryW_Dispose(entry); CkZipEntryW_Dispose(entry2); } |
||||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.