Sample code for 30+ languages & platforms
C++

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat C++ Downloads

C++
#include <CkStringBuilder.h>

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

    CkStringBuilder sb;

    sb.Append(s);

    //  output: The quick brown fox jumps over the lazy dog
    std::cout << sb.getAsString() << "\r\n";

    //  Get the string encoded to base64, without changing the contents of sb.
    //  output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
    std::cout << sb.getEncoded("base64","utf-8") << "\r\n";

    //  The contents of sb are not changed..
    //  output: The quick brown fox jumps over the lazy dog
    std::cout << sb.getAsString() << "\r\n";
    }