C++
C++
Convert HTML to Plain Text
Demonstrates how to convert HTML to plain text.Chilkat C++ Downloads
#include <CkHtmlToText.h>
void ChilkatSample(void)
{
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHtmlToText h2t;
const char *html = h2t.readFileToString("c:/temp/test.html","utf-8");
if (h2t.get_LastMethodSuccess() == false) {
std::cout << h2t.lastErrorText() << "\r\n";
return;
}
const char *plainText = h2t.toText(html);
if (h2t.get_LastMethodSuccess() == false) {
std::cout << h2t.lastErrorText() << "\r\n";
return;
}
std::cout << plainText << "\r\n";
}