Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Iterate Over Files in a Zip ArchiveDownloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries Demonstrates how to iterate over the contents of a Zip compression archive. // Visual C++ Example Source Code to open a Zip file and iterate // over the contents. // #include "stdafx.h" #include <stdio.h> #include "CkZip.h" #include "CkZipEntry.h" #include "CkString.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { freopen("stdout.txt","w",stdout); // Unlock the Zip product. // This only needs to be done once when the first CkZip object // is instantiated. CkZip zip; zip.UnlockComponent("unlockCode"); // Create a new Zip and append files and directories recursively. zip.OpenZip("tree.zip"); // Iterate over the entries in the Zip. CkZipEntry *entry = zip.FirstEntry(); CkString sFilename; while (entry) { // Print the filename, and the uncompressed and compressed sizes. entry->get_FileName(sFilename); printf("%s, %d, %d\n",sFilename.getString(), entry->get_UncompressedLength(),entry->get_CompressedLength()); CkZipEntry *temp = entry; entry = entry->NextEntry(); delete temp; } zip.CloseZip(); return 0; }
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.