(Unicode C) Appending Strings to BinData
Demonstrates appending strings to a BinData..
#include <C_CkBinDataW.h>
void ChilkatSample(void)
{
HCkBinDataW binData1;
HCkBinDataW binData2;
binData1 = CkBinDataW_Create();
// Append a string using a 1-byte per char encoding
CkBinDataW_AppendString(binData1,L"This is a test",L"windows-1252");
wprintf(L"%s\n",CkBinDataW_getEncoded(binData1,L"hex"));
// The bytes contained within the binData1 (in hex) are: 54,68,69,73,20,69, ...
binData2 = CkBinDataW_Create();
// Append a string using a 2-byte per char encoding
CkBinDataW_AppendString(binData2,L"This is a test",L"utf-16");
wprintf(L"%s\n",CkBinDataW_getEncoded(binData2,L"hex"));
// The bytes contained within the binData2 (in hex) are: 54,00,68,00,69,00,73,00,20,00,69,00, ...
CkBinDataW_Dispose(binData1);
CkBinDataW_Dispose(binData2);
}
|