C++
C++
List Files in a .zip
See more Zip Examples
How to list files within a .zipChilkat C++ Downloads
#include <CkZip.h>
#include <CkZipEntry.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.
CkZip zip;
success = zip.OpenZip("a.zip");
if (success == false) {
std::cout << zip.lastErrorText() << "\r\n";
return;
}
// Get the number of files and directories in the .zip
int n = zip.get_NumEntries();
CkZipEntry entry;
int i = 0;
while (i < n) {
zip.EntryAt(i,entry);
if (entry.get_IsDirectory() == false) {
// (the filename may include a path)
std::cout << entry.fileName() << "\r\n";
}
i = i + 1;
}
}