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
Zip a Directory TreeDownloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries Very simple example showing how to Zip a directory tree. // Visual C++ Example Source Code to create a Zip file
//
#include "stdafx.h"
#include "CkZip.h"
#include "CkZipEntry.h"
void testCreateZip(void)
{
// Unlock the Zip product.
// This only needs to be done once when the first CkZip object
// is instantiated. Any string automatically starts a fully-functional
// 30-day trial.
CkZip zip;
bool success = zip.UnlockComponent("Anything for 30-day trial.");
if (!success)
{
printf("%s\n",zip.lastErrorText());
return;
}
// Create a new Zip and append files and directories recursively.
zip.NewZip("myZip.zip");
success = zip.AppendFiles("./Tree/*",true,0);
if (!success)
{
printf("%s\n",zip.lastErrorText());
return;
}
success = zip.WriteZipAndClose(0);
if (!success)
{
printf("%s\n",zip.lastErrorText());
return;
}
// Memory Leaks? See CkSettings for more information about how
// many C++ programmers mistakenly think there are memory leaks.
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
testCreateZip();
return 0;
}
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.