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
Change a Filename before UnzippingHow to open a zip and modify the filename of one or more files within the zip before unzipping. Downloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries FreeBSD C++ Libraries HP-UX C++ Libraries BlackBerry QNX C++ Libraries #include <C_CkZip.h> #include <C_CkZipEntry.h> void ChilkatSample(void) { HCkZip zip; BOOL success; HCkZipEntry entry; long numFilesUnzipped; zip = CkZip_Create(); // Any string unlocks the component for the 1st 30-days. success = CkZip_UnlockComponent(zip,"Anything for 30-day trial"); if (success != TRUE) { printf("%s\n",CkZip_lastErrorText(zip)); return; } success = CkZip_OpenZip(zip,"test.zip"); if (success != TRUE) { printf("%s\n",CkZip_lastErrorText(zip)); return; } entry = CkZip_GetEntryByName(zip,"hamlet.xml"); // Assume entry is non-null. If GetEntryByName failed // to find the entry, it returns a null reference. CkZipEntry_putFileName(entry,"hamlet2.xml"); CkZipEntry_Dispose(entry); entry = CkZip_GetEntryByName(zip,"helloWorld.pl"); CkZipEntry_putFileName(entry,"hw.pl"); CkZipEntry_Dispose(entry); // Now unzip to the "test" subdirectory, under our current // working directory: numFilesUnzipped = CkZip_Unzip(zip,"test"); if (numFilesUnzipped < 0) { printf("%s\n",CkZip_lastErrorText(zip)); return; } // The filenames within the .zip are unchanged, but it unzipped // test/hw.pl and test/hamlet2.xml CkZip_Dispose(zip); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.