Hey there I have a data structure with a set size of 40 I want to marshall the data from an object into an array of characters for simplistic transmission of data. I am aware of serialization but only familiar with it in higher languages, I am stuck using c.
My question is this. How do I point to an individual character value of the unmarshalled object in order to marshall it into a character array I can throw down the socket pipe?
char dataToSend[40];
I assume I need a loop but have no method to break up host control item struct into an assignable single character form.
dataToSend = (char*)&hostControlItem; throws an error.
dataToSend = (char[40]*)&hostControlItem; throws an error.
dataToSend = (char*[40])&hostControlItem; throws an error.
In pseudo code I need
for (int i = 0; i <40; i++)
{
dataToSend[i] = (char*)&hostControlItem.asBinary([i]);
}
Is there an inbuilt method to convert an object to a character array? google was useless!