![]() |
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
(PureBasic) 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.
IncludeFile "CkZip.pb" IncludeFile "CkZipEntry.pb" Procedure ChilkatExample() success.i = 0 success = 0 ; Open an existing ZIP archive. zip.i = CkZip::ckCreate() If zip.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkZip::ckOpenZip(zip,"example.zip") If success = 0 Debug CkZip::ckLastErrorText(zip) CkZip::ckDispose(zip) ProcedureReturn EndIf ; Retrieve the first entry in the ZIP archive. entry.i = CkZipEntry::ckCreate() If entry.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkZip::ckEntryAt(zip,0,entry) If success = 0 Debug CkZip::ckLastErrorText(zip) CkZip::ckDispose(zip) CkZipEntry::ckDispose(entry) ProcedureReturn EndIf Debug "Original entry:" Debug " FileName: " + CkZipEntry::ckFileName(entry) Debug " EntryID: " + Str(CkZipEntry::ckEntryID(entry)) Debug "" ; Save the EntryID for later use. entryId.i = CkZipEntry::ckEntryID(entry) ; Create another ZipEntry object. entry2.i = CkZipEntry::ckCreate() If entry2.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Retrieve the same entry using EntryById. success = CkZip::ckEntryById(zip,entryId,entry2) If success = 0 Debug CkZip::ckLastErrorText(zip) CkZip::ckDispose(zip) CkZipEntry::ckDispose(entry) CkZipEntry::ckDispose(entry2) ProcedureReturn EndIf Debug "Entry retrieved by EntryID:" Debug " FileName: " + CkZipEntry::ckFileName(entry2) Debug " EntryID: " + Str(CkZipEntry::ckEntryID(entry2)) Debug "" ; The filenames and EntryID values should match. CkZip::ckCloseZip(zip) Debug "Done." CkZip::ckDispose(zip) CkZipEntry::ckDispose(entry) CkZipEntry::ckDispose(entry2) ProcedureReturn EndProcedure |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.