Assuming I want to transmit data from one process (1) to another (2).
struct test {
uint8_t a;
uint8_t b;
}
this structure is sent via a buffer. I use a function of the second process to transmit the data.
write(unsigned char* buffer, int size)
in the main I do
int main(){
test sendData;
unsigned char buffer[2]
sendData.a = 10;
sendData.b = 20;
std::memcpy(buffer,&sendData,sizeof(test));
_device.write(buffer, sizeof(buffer));// assume that _device is my second process instance
}
how can I know which data representation to use to comunicate with the second process ?
is it a big endian or a little endian ? or does it depend on the processor architecture ? how can I know that ?