Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C) Decompress BytesDemonstrates how to decompress binary data.
#include <C_CkFileAccessW.h> #include <C_CkByteData.h> #include <C_CkCompressionW.h> void ChilkatSample(void) { HCkFileAccessW fac; HCkByteData compressedBytes; HCkCompressionW compress; HCkByteData decompressedBytes; BOOL success; // 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 fac = CkFileAccessW_Create(); compressedBytes = CkByteData_Create(); success = CkFileAccessW_ReadEntireFile(fac,L"qa_data/compressed/compressedBmp.dat",compressedBytes); if (CkFileAccessW_getLastMethodSuccess(fac) != TRUE) { wprintf(L"%s\n",CkFileAccessW_lastErrorText(fac)); CkFileAccessW_Dispose(fac); CkByteData_Dispose(compressedBytes); return; } compress = CkCompressionW_Create(); CkCompressionW_putAlgorithm(compress,L"deflate"); decompressedBytes = CkByteData_Create(); success = CkCompressionW_DecompressBytes(compress,compressedBytes,decompressedBytes); if (CkCompressionW_getLastMethodSuccess(compress) != TRUE) { wprintf(L"%s\n",CkCompressionW_lastErrorText(compress)); CkFileAccessW_Dispose(fac); CkByteData_Dispose(compressedBytes); CkCompressionW_Dispose(compress); CkByteData_Dispose(decompressedBytes); return; } success = CkFileAccessW_WriteEntireFile(fac,L"qa_output/decompressed.bmp",decompressedBytes); if (CkFileAccessW_getLastMethodSuccess(fac) != TRUE) { wprintf(L"%s\n",CkFileAccessW_lastErrorText(fac)); CkFileAccessW_Dispose(fac); CkByteData_Dispose(compressedBytes); CkCompressionW_Dispose(compress); CkByteData_Dispose(decompressedBytes); return; } CkFileAccessW_Dispose(fac); CkByteData_Dispose(compressedBytes); CkCompressionW_Dispose(compress); CkByteData_Dispose(decompressedBytes); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.