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

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkStringBuilderW.h>

void ChilkatSample(void)
    {
    const wchar_t *s = L"The quick brown fox jumps over the lazy dog";

    CkStringBuilderW sb;

    sb.Append(s);

    //  output: The quick brown fox jumps over the lazy dog
    wprintf(L"%s\n",sb.getAsString());

    //  Get the string encoded to base64, without changing the contents of sb.
    //  output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
    wprintf(L"%s\n",sb.getEncoded(L"base64",L"utf-8"));

    //  The contents of sb are not changed..
    //  output: The quick brown fox jumps over the lazy dog
    wprintf(L"%s\n",sb.getAsString());
    }