Sample code for 30+ languages & platforms
Unicode C++

Appending Strings to BinData

Demonstrates appending strings to a BinData..

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkBinDataW.h>

void ChilkatSample(void)
    {
    CkBinDataW binData1;

    // Append a string using a 1-byte per char encoding
    binData1.AppendString(L"This is a test",L"windows-1252");
    wprintf(L"%s\n",binData1.getEncoded(L"hex"));
    // The bytes contained within the binData1 (in hex) are: 54,68,69,73,20,69, ...

    CkBinDataW binData2;

    // Append a string using a 2-byte per char encoding
    binData2.AppendString(L"This is a test",L"utf-16");
    wprintf(L"%s\n",binData2.getEncoded(L"hex"));
    // The bytes contained within the binData2 (in hex) are: 54,00,68,00,69,00,73,00,20,00,69,00, ...
    }