Unicode C++
Unicode C++
List Files in a .zip
See more Zip Examples
How to list files within a .zipChilkat Unicode C++ Downloads
#include <CkZipW.h>
#include <CkZipEntryW.h>
void ChilkatSample(void)
{
bool success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkZipW zip;
success = zip.OpenZip(L"a.zip");
if (success == false) {
wprintf(L"%s\n",zip.lastErrorText());
return;
}
// Get the number of files and directories in the .zip
int n = zip.get_NumEntries();
CkZipEntryW entry;
int i = 0;
while (i < n) {
zip.EntryAt(i,entry);
if (entry.get_IsDirectory() == false) {
// (the filename may include a path)
wprintf(L"%s\n",entry.fileName());
}
i = i + 1;
}
}