Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual C++ Examples

CkString
Byte Array
Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

 

beginsWith -- Check if Byte Array Begins with Byte Sequence

Determine if a byte array begins with a specific byte sequence.

Download Chilkat C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C++ Libraries for VC++ 6.0 / Win32

#include <CkByteData.h>

void ChilkatSample(void)
    {
    CkByteData zipData;
    CkByteData gifData;

    bool success;

    //  Zip files begin with these 4 bytes:
    unsigned char zipBegin_bytes[] = { 0x50, 0x4B, 3, 4};
    CkByteData zipBegin;
    zipBegin.append(zipBegin_bytes, 4);

    //  GIF files begin with "GIF89", which is this byte sequence:
    unsigned char gifBegin_bytes[] = { 0x47, 0x49, 0x46, 0x38, 0x39};
    CkByteData gifBegin;
    gifBegin.append(gifBegin_bytes, 5);

    success = zipData.loadFile("dude.zip");
    if (success == true) {
        if (zipData.beginsWith(zipBegin)) {
            printf("Yes, this is a .zip archive!\n");
        }
        else {
            printf("No, this is not a .zip archive.\n");
        }

    }
    else {
        printf("Failed to load dude.zip\n");
    }

    success = gifData.loadFile("dude.gif");
    if (success == true) {
        if (gifData.beginsWith(gifBegin)) {
            printf("Yes, this is a GIF image!\n");
        }
        else {
            printf("No, this is not a GIF image.\n");
        }

    }
    else {
        printf("Failed to load dude.gif\n");
    }

    }

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

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

Mail Component · .NET Mail Component · XML Parser