I have a structure as follows
struct msg {
uint16_t data1;
int data2;
}
I am sending it through the serial port after converting the structure data into a string (char buffer).
I am actually using memcpy to copy the contents into the buffer (using PRAGMA for struct packing)
The problem what I face is the puts function of my board, will stop once it encounters a NULL character (ie if 1 bye is 0, as ASCII equivalent o decimal 0 is NULL)
if data2 = 12 then the memory after memcpy will be 00 00 00 0C (HEX). One puts sees the first 00 it stops and returns.
I cannot change my serial port setting or the puts function. What is best method to convert int into 4 byte's in char buffer without any byte being 0