![]() |
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
(Objective-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.
#import <CkoZip.h> #import <CkoZipEntry.h> BOOL success = NO; success = NO; // Open an existing ZIP archive. CkoZip *zip = [[CkoZip alloc] init]; success = [zip OpenZip: @"example.zip"]; if (success == NO) { NSLog(@"%@",zip.LastErrorText); return; } // Retrieve the first entry in the ZIP archive. CkoZipEntry *entry = [[CkoZipEntry alloc] init]; success = [zip EntryAt: [NSNumber numberWithInt: 0] entry: entry]; if (success == NO) { NSLog(@"%@",zip.LastErrorText); return; } NSLog(@"%@",@"Original entry:"); NSLog(@"%@%@",@" FileName: ",entry.FileName); NSLog(@"%@%d",@" EntryID: ",[entry.EntryID intValue]); NSLog(@"%@",@""); // Save the EntryID for later use. int entryId = [entry.EntryID intValue]; // Create another ZipEntry object. CkoZipEntry *entry2 = [[CkoZipEntry alloc] init]; // Retrieve the same entry using EntryById. success = [zip EntryById: [NSNumber numberWithInt: entryId] entry: entry2]; if (success == NO) { NSLog(@"%@",zip.LastErrorText); return; } NSLog(@"%@",@"Entry retrieved by EntryID:"); NSLog(@"%@%@",@" FileName: ",entry2.FileName); NSLog(@"%@%d",@" EntryID: ",[entry2.EntryID intValue]); NSLog(@"%@",@""); // The filenames and EntryID values should match. [zip CloseZip]; NSLog(@"%@",@"Done."); |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.