Unicode C++
Unicode C++
Get Contents of File as Base64
See more Encryption Examples
Demonstrates how to read the contents of a file and convert to a base64 string.Chilkat Unicode C++ Downloads
#include <CkBinDataW.h>
void ChilkatSample(void)
{
bool success = false;
CkBinDataW bd;
success = bd.LoadFile(L"qa_data/jpg/starfish.jpg");
if (success == false) {
wprintf(L"Failed to load file.\n");
return;
}
wprintf(L"%s\n",bd.getEncoded(L"base64"));
// If you want mult-line base64:
wprintf(L"--\n");
wprintf(L"%s\n",bd.getEncoded(L"base64_mime"));
// If you want hex..
wprintf(L"--\n");
wprintf(L"%s\n",bd.getEncoded(L"hex"));
// etc.
}