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