Programming Examples

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

C Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
DKIM / DomainKey
Diffie-Hellman
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

 

 

 

 

 

 

 

 

Create TAR Archive

Demonstrates how to create a TAR archive containing an entire directory tree.

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
FreeBSD C++ Libraries
HP-UX C++ Libraries
BlackBerry QNX C++ Libraries
#include <C_CkTar.h>

void ChilkatSample(void)
    {
    HCkTar tar;
    BOOL success;

    //  Important: It is helpful to send the contents of the
    //  tar.LastErrorText property when requesting support.

    tar = CkTar_Create();

    //  Any string automatically begins a fully-functional 30-day trial.

    success = CkTar_UnlockComponent(tar,"Anything for 30-day trial");
    if (success != TRUE) {
        printf("%s\n",CkTar_lastErrorText(tar));
        return;
    }

    //  The TAR component will produce a  GNU tar 1.13.x format
    //  archive by default.
    //  It is also possible to create PAX -- POSIX 1003.1-2001 format
    //  or USTAR -- POSIX 1003.1-1988 format.
    //  Set the WriteFormat property to "gnu", "pax", or "ustar" to
    //  choose the output TAR format:
    CkTar_putWriteFormat(tar,"gnu");

    //  Add a directory tree to be included in the output TAR archive:
    success = CkTar_AddDirRoot(tar,"/Users/chilkat/temp/abc123");
    if (success != TRUE) {
        printf("%s\n",CkTar_lastErrorText(tar));
        return;
    }

    //  Create the TAR archive.
    //  Note: You may use UNC paths, absolute, or relative paths.
    success = CkTar_WriteTar(tar,"/Users/chilkat/testData/tar/abc123.tar");
    if (success != TRUE) {
        printf("%s\n",CkTar_lastErrorText(tar));
        return;
    }

    printf("Success.\n");

    CkTar_Dispose(tar);

    }

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

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