C#
C#
Unzip Text File to String
See more Zip Examples
Demonstrates how to open a .zip and extract the 1st file (assuming it's a text file) to a string variable.Chilkat C# Downloads
bool success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.Zip zip = new Chilkat.Zip();
success = zip.OpenZip("qa_data/zips/EC16100.zip");
if (success == false) {
Debug.WriteLine(zip.LastErrorText);
return;
}
// Get the 1st file in the .zip
Chilkat.ZipEntry entry = new Chilkat.ZipEntry();
success = zip.EntryAt(0,entry);
if (success == false) {
Debug.WriteLine(zip.LastErrorText);
return;
}
string fileContents = entry.UnzipToString(0,"utf-8");
Debug.WriteLine(fileContents);