![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C++) Retrieve Metadata from Gzip Data in Memory (BinData)This example demonstrates how to use the The Gzip data is first loaded into the The metadata is returned in a Note: This example requires Chilkat v11.5.0 or greater.
#include <CkGzipW.h> #include <CkBinDataW.h> #include <CkJsonObjectW.h> void ChilkatSample(void) { bool success = false; // This example demonstrates how to retrieve metadata from Gzip data // stored in a BinData object. CkGzipW gzip; CkBinDataW bd; CkJsonObjectW json; // Load a Gzip file into BinData: success = bd.LoadFile(L"example.txt.gz"); if (success == false) { wprintf(L"%s\n",bd.lastErrorText()); return; } // Get the metadata information from the in-memory Gzip data: success = gzip.GetGzipInfoBd(bd,json); if (success == false) { wprintf(L"%s\n",gzip.lastErrorText()); return; } // Output the JSON containing metadata: wprintf(L"Gzip metadata JSON:\n"); wprintf(L"%s\n",json.emit()); // Access individual fields only if they exist: if (json.HasMember(L"filename") == true) { const wchar_t *filename = json.stringOf(L"filename"); wprintf(L"Filename: %s\n",filename); } if (json.HasMember(L"comment") == true) { const wchar_t *comment = json.stringOf(L"comment"); wprintf(L"Comment: %s\n",comment); } if (json.HasMember(L"extraData") == true) { const wchar_t *extraData = json.stringOf(L"extraData"); wprintf(L"ExtraData (Base64): %s\n",extraData); } } |
||||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.