Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
.gz Format GZip and Ungzip 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);
}
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.