Sample code for 30+ languages & platforms
C++

Convert HTML to plain-text

See more HTML-to-XML/Text Examples

Demonstrates how to convert HTML to plain-text.

Chilkat C++ Downloads

C++
#include <CkHtmlToText.h>

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

    CkHtmlToText h2t;

    //  Set the HTML:
    const char *html = 0;
    html = "<html><body><p>This is a test.</p><blockquote>Here is text within a blockquote</blockquote></body></html>";

    const char *plainText = 0;

    plainText = h2t.toText(html);

    std::cout << plainText << "\r\n";

    //  The output looks like this:

    //  This is a test.
    //  
    //      Here is text within a blockquote
    }