Unicode C++
Unicode C++
Transition from ZipEntry.NextEntry to ZipEntry.GetNext
Provides instructions for replacing deprecated NextEntry method calls with GetNext.Chilkat Unicode C++ Downloads
#include <CkZipW.h>
#include <CkZipEntryW.h>
void ChilkatSample(void)
{
bool success = false;
// ------------------------------------------------------------------------
// The NextEntry method is deprecated.
// See below or code showing how to rewrite using EntryAt/GetNext
CkZipW zip;
success = zip.OpenZip(L"qa_data/zips/xml_files.zip");
if (success != true) {
wprintf(L"%s\n",zip.lastErrorText());
return;
}
CkZipEntryW *entry = zip.FirstEntry();
if (zip.get_LastMethodSuccess() == false) {
wprintf(L"This zip archive is empty.\n");
return;
}
bool finished = false;
while (finished == false) {
if (entry->get_IsDirectory() == false) {
wprintf(L"%s\n",entry->fileName());
}
else {
wprintf(L"(directory) %s\n",entry->fileName());
}
CkZipEntryW *next = entry->NextEntry();
if (entry->get_LastMethodSuccess() == false) {
finished = true;
}
delete entry;
entry = next;
}
zip.CloseZip();
wprintf(L"----\n");
// ------------------------------------------------------------------------
// Do the equivalent using EntryAt/GetNext.
success = zip.OpenZip(L"qa_data/zips/xml_files.zip");
CkZipEntryW ze;
zip.EntryAt(0,ze);
bool entryValid = true;
while (entryValid == true) {
if (ze.get_IsDirectory() == false) {
wprintf(L"%s\n",ze.fileName());
}
else {
wprintf(L"(directory) %s\n",ze.fileName());
}
entryValid = ze.GetNext();
}
zip.CloseZip();
}