![]() |
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
(Swift) 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.
func chilkatTest() { var success: Bool = false success = false // Open an existing ZIP archive. let zip = CkoZip()! success = zip.open("example.zip") if success == false { print("\(zip.lastErrorText!)") return } // Retrieve the first entry in the ZIP archive. let entry = CkoZipEntry()! success = zip.entry(at: 0, entry: entry) if success == false { print("\(zip.lastErrorText!)") return } print("Original entry:") print(" FileName: \(entry.fileName!)") print(" EntryID: \(entry.entryID.intValue)") print("") // Save the EntryID for later use. var entryId: Int = entry.entryID.intValue // Create another ZipEntry object. let entry2 = CkoZipEntry()! // Retrieve the same entry using EntryById. success = zip.entry(byId: entryId, entry: entry2) if success == false { print("\(zip.lastErrorText!)") return } print("Entry retrieved by EntryID:") print(" FileName: \(entry2.fileName!)") print(" EntryID: \(entry2.entryID.intValue)") print("") // The filenames and EntryID values should match. zip.close() print("Done.") } |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.