Sample code for 30+ languages & platforms
Unicode C++

Ungzip Base64 String

See more Gzip Examples

Suppose you have a gzip in base64 representation that contains a text file, such as XML. This example shows how to decompress and access the string.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkGzipW.h>
#include <CkBinDataW.h>

void ChilkatSample(void)
    {
    bool success = false;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkGzipW gzip;

    const wchar_t *gzipBase64 = L"H4sIAAAAAAAE ... X6aZjXO3EwAA";

    CkBinDataW bd;
    success = bd.AppendEncoded(gzipBase64,L"base64");

    success = gzip.UncompressBd(bd);
    if (success != true) {
        wprintf(L"%s\n",gzip.lastErrorText());
        return;
    }

    const wchar_t *strXml = bd.getString(L"utf-8");
    wprintf(L"XML:\n");
    wprintf(L"%s\n",strXml);
    }