Unicode C++
Unicode C++
Transition from Zip.AppendDataEncoded to Zip.AddEncoded
Provides instructions for replacing deprecated AppendDataEncoded method calls with AddEncoded.Chilkat Unicode C++ Downloads
#include <CkZipW.h>
#include <CkZipEntryW.h>
void ChilkatSample(void)
{
bool success = false;
CkZipW zip;
// ...
// ...
const wchar_t *pathInZip = L"example.dat";
const wchar_t *encoding = L"base64";
const wchar_t *encData = L"... BASE64 DATA ...";
// ------------------------------------------------------------------------
// The AppendDataEncoded method is deprecated:
CkZipEntryW *entryObj = zip.AppendDataEncoded(pathInZip,encoding,encData);
if (zip.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",zip.lastErrorText());
return;
}
// ...
// ...
delete entryObj;
// ------------------------------------------------------------------------
// Do the equivalent using AddEncoded.
// Instead of returning the zip entry object, we just return success/failure.
success = zip.AddEncoded(pathInZip,encoding,encData);
if (success == false) {
wprintf(L"%s\n",zip.lastErrorText());
return;
}
// Do the following if you need the zip entry object for what was just appended.
// The newly appended entry is the last one.
CkZipEntryW ze;
int index = zip.get_NumEntries() - 1;
zip.EntryAt(index,ze);
}