(Unicode C++) Extract Files from MIME
Extract files from a MIME message. Note: This example requires Chilkat v11.0.0 or greater.
#include <CkMimeW.h>
#include <CkStringTableW.h>
void ChilkatSample(void)
{
bool success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkMimeW mime;
// Load a MIME document from a file:
// (.mht and .eml files contain MIME).
success = mime.LoadMimeFile(L"mst.mht");
if (success == false) {
wprintf(L"%s\n",mime.lastErrorText());
return;
}
CkStringTableW st;
success = mime.PartsToFiles(L"/temp/mimeParts",st);
if (success == false) {
wprintf(L"%s\n",mime.lastErrorText());
return;
}
int n = st.get_Count();
// Display the paths of the files created:
int i = 0;
while (i < n) {
wprintf(L"%s\n",st.stringAt(i));
i = i + 1;
}
}
|