static MCD_STR CMarkup::EncodeBase64( const unsigned char* pBuffer, int nBufferLen );
Base64 is a way of encoding a binary value into an ASCII text value that will not interfere with markup tags (see How To Handle Binary Data). Use this
EncodeBase64 method to go from binary to Base64 text and use the DecodeBase64 method to go from Base64 text to binary.
pBuffer argument points to binary data, and
nBufferLen is the length in bytes of that data. Add binary data to a document simply by encoding it as it is added to the document:
xml.AddElem( "IMAGE", CMarkup::EncodeBase64(pBuffer,nBufferLen) );
For an example of a round trip from a binary file into an XML document and back out to file again, see DecodeBase64.