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

 

 

 

 

 

 

 

 

Embedding a BMP Image into an XML Document with Zip Data Compression

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

Source Code Listing

// Store a Zip compressed BMP image in an XML file.
void CreateBmpXml(void)
    {
    // Our XML document.
    CkXml xml;
    xml.put_Tag("root");

    // Load a file.
    CkByteData byteData;
    byteData.loadFile("dudeCPP.bmp");

    // Create a child XML node to hold the BMP image.
    CkXml *node = xml.NewChild("bmp_image","");

    // Add the filename as an attribute.
    node->AddAttribute("filename","dudeCPP.bmp");

    // Add the binary data (and Zip compress it.)
    bool zipCompress = true;
    bool aesEncrypt = false;
    const char *aesPassword = 0;
    node->SetBinaryContent(byteData.getData(),byteData.getSize(),zipCompress,aesEncrypt,aesPassword);

    // Save the XML.
    xml.SaveXml("BmpImage.xml");

    
    // Access the binary data and save it to another BMP to 
    // prove that the data is preserved.
    CkByteData b;
    node->GetBinaryContent(b,zipCompress,aesEncrypt,aesPassword);
    b.saveFile("dudeOut.bmp");

    delete node;

    return;
    }







 

 

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