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

Convert HTML to Plain Text

Demonstrates how to convert HTML to plain text.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkHtmlToTextW.h>

void ChilkatSample(void)
    {
    //  This example requires the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    CkHtmlToTextW h2t;

    const wchar_t *html = h2t.readFileToString(L"c:/temp/test.html",L"utf-8");
    if (h2t.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",h2t.lastErrorText());
        return;
    }

    const wchar_t *plainText = h2t.toText(html);
    if (h2t.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",h2t.lastErrorText());
        return;
    }

    wprintf(L"%s\n",plainText);
    }