Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Iterate Over Files in a Zip Archive
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;
}
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.