Sample code for 30+ languages & platforms
Lianja

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 Lianja Downloads

Lianja
llSuccess = .F.

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loZip = createobject("CkZip")

llSuccess = loZip.OpenZip("qa_data/zips/EC16100.zip")
if (llSuccess = .F.) then
    ? loZip.LastErrorText
    release loZip
    return
endif

// Get the 1st file in the .zip
loEntry = createobject("CkZipEntry")
llSuccess = loZip.EntryAt(0,loEntry)
if (llSuccess = .F.) then
    ? loZip.LastErrorText
    release loZip
    release loEntry
    return
endif

lcFileContents = loEntry.UnzipToString(0,"utf-8")
? lcFileContents


release loZip
release loEntry