Sample code for 30+ languages & platforms
C

Save Web Page to MHT String

See more MHT / HTML Email Examples

Downloads a web page into a string variable containing MHT. MHT is a web archive with all images and style sheets embedded. It's a MIME-formatted text document. When saved with the .mht extension, Internet Explorer can open and display the page.

Chilkat C Downloads

C
#include <C_CkMht.h>

void ChilkatSample(void)
    {
    HCkMht mht;
    const char *mhtStr;

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

    mht = CkMht_Create();

    mhtStr = CkMht_getMHT(mht,"http://www.google.com/");
    if (CkMht_getLastMethodSuccess(mht) != TRUE) {
        printf("%s\n",CkMht_lastErrorText(mht));

    }
    else {
        printf("%s\n",mhtStr);
    }



    CkMht_Dispose(mht);

    }