Hi, I am trying to write a 13 bit unint value to a binary file using .write but the value seems to be wrong.
uint8 u8;
u32 = (u8<<5) + (u8>>3); //Logic to convert to u13
_file.open(_filename.c_str(), std::ofstream::app);
_file.write((char *)&u32, sizeof(u32));
What is the correct approach ?