(Unicode C++) Decompress Bytes
Demonstrates how to decompress binary data.
#include <CkFileAccessW.h>
#include <CkByteData.h>
#include <CkCompressionW.h>
void ChilkatSample(void)
{
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// See this example to compress bytes: Compress Bytes
CkFileAccessW fac;
CkByteData compressedBytes;
success = fac.ReadEntireFile(L"qa_data/compressed/compressedBmp.dat",compressedBytes);
if (fac.get_LastMethodSuccess() != true) {
wprintf(L"%s\n",fac.lastErrorText());
return;
}
CkCompressionW compress;
compress.put_Algorithm(L"deflate");
CkByteData decompressedBytes;
success = compress.DecompressBytes(compressedBytes,decompressedBytes);
if (compress.get_LastMethodSuccess() != true) {
wprintf(L"%s\n",compress.lastErrorText());
return;
}
bool success = fac.WriteEntireFile(L"qa_output/decompressed.bmp",decompressedBytes);
if (fac.get_LastMethodSuccess() != true) {
wprintf(L"%s\n",fac.lastErrorText());
return;
}
}
|