Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
.gz Format GZip and UngzipDownloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries Demonstrates how to use the CkGZip C++ class to compress and uncompress .gz file format files and memory. void GZipExample(void)
{
// The CkGzip class is included with the "Chilkat Zip" license.
CkGzip gzip;
gzip.UnlockComponent("Anything for 30-day trial");
// ungzip a .gz file:
gzip.UncompressFile("helloWorld.txt.gz","helloWorld.txt");
// Create a .gz compressed file.
gzip.CompressFile("helloWorld.txt","helloWorld2.txt.gz");
CkByteData byteData;
// Ungzip from file to memory:
gzip.UncompressFileToMem("helloWorld.txt.gz",byteData);
// Access the data:
const unsigned char *data = byteData.getData();
int numBytes = byteData.getSize();
// Compress from memory to file:
gzip.CompressMemToFile(byteData,"helloWorld3.txt.gz");
// Memory-to-memory compress:
CkByteData compressedData;
gzip.CompressMemory(byteData,compressedData);
// Access the compressed data:
data = compressedData.getData();
numBytes = compressedData.getSize();
// Memory-to-memory ungzip
byteData.clear();
gzip.UncompressMemory(compressedData,byteData);
// Ungzip from memory to file:
gzip.UncompressMemToFile(compressedData,"helloWorld4.txt");
// Compress from file to memory:
compressedData.clear();
gzip.CompressFileToMem("helloWorld4.txt",compressedData);
}
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.