Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
|
List Files in a .zipHow to list files within a .zip Download: Chilkat Cocoa Objective-C Libraries NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000]; CkoZip *zip = [[[CkoZip alloc] init] autorelease]; BOOL success; // Any string unlocks the component for the 1st 30-days. success = [zip UnlockComponent: @"30-day trial"]; if (success != YES) { [strOutput appendString: zip.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } success = [zip OpenZip: @"a.zip"]; if (success != YES) { [strOutput appendString: zip.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } int n; // Get the number of files and directories in the .zip n = [zip.NumEntries intValue]; [strOutput appendString:[NSString stringWithFormat: @"%d\n",n]]; CkoZipEntry *entry; int i; for (i = 0; i <= n - 1; i++) { entry = [zip GetEntryByIndex: [NSNumber numberWithInt: i]]; if (entry.IsDirectory == NO) { // (the filename may include a path) [strOutput appendString: entry.FileName]; [strOutput appendString: @"\n"]; } } self.mainTextField.stringValue = strOutput; |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.