MFC Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

MFC Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
Diffie-Hellman
DKIM / DomainKey
DSA
Email Object
Encryption
FileAccess
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
MIME
NTLM
POP3
RSA
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
Zip
Amazon S3


 

 

 

 

 

 

 

 

Unzip a Single File by Index

Unzip a single file by index.

Downloads:

MS Windows Visual C/C++ Libraries
Linux/CentOS C/C++ Libraries
MAC OS X C/C++ Libraries
Solaris C/C++ Libraries
C++ Builder Libraries
// Needs #include <CkZip.h>
// Needs #include <CkZipEntry.h>

    CkString strOut;

    CkZip zip;

    bool success;

    //  Any string unlocks the component for the 1st 30-days.
    success = zip.UnlockComponent("Anything for 30-day trial");
    if (success != true) {
        strOut.append(zip.lastErrorText());
        strOut.append("\r\n");
        SetDlgItemText(IDC_EDIT1,strOut.getUnicode());
        return;
    }

    success = zip.OpenZip("my_photos.zip");
    if (success != true) {
        strOut.append(zip.lastErrorText());
        strOut.append("\r\n");
        SetDlgItemText(IDC_EDIT1,strOut.getUnicode());
        return;
    }

    //  How many files and directory entries are in this .zip?
    long n;
    n = zip.get_NumEntries();
    strOut.append("Num entries = ");
    strOut.appendInt(n);
    strOut.append("\r\n");

    //  Let's say we want to unzip the 3rd entry:
    CkZipEntry *entry = 0;
    entry = zip.GetEntryByIndex(2);
    if (entry == 0 ) {
        strOut.append("Index out of range!\r\n");
        SetDlgItemText(IDC_EDIT1,strOut.getUnicode());
        return;
    }
    else {
        //  Unzip it to C:/myTempDir
        success = entry->ExtractInto("c:/myTempDir");
        if (success != true) {
            strOut.append(entry->lastErrorText());
            strOut.append("\r\n");
            SetDlgItemText(IDC_EDIT1,strOut.getUnicode());
            return;
        }
        else {
            strOut.append("Extracted 1 file!\r\n");
        }

    }



    SetDlgItemText(IDC_EDIT1,strOut.getUnicode());

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.