Is there a way to write the binary representation of a uint8_t to HDF5? For example, if the value is 4, the resulting value in HDF5 should be 00000100. This binary value is located in a compound datatype with various other data that I am storing.
Here's what I've tried
- Convert the original uint8_t to char array. This works but makes the struct extremely large, not to mention that characters are handled differently with different compilers
- Use a uint8_t array to represent each binary bit value. For example [1,0,0] is 100. Also very large and does not nicely write to hdf5.
- Defining the datatype differently: I've tried defining the datatype as a character string, bitfield (B8 and BITFIELD), and simply as NATIVE_UINT8.
- Converting to std::bitset requires that I convert to string and ultimately save the value as string, which doesn't help with my goals of reducing file size/memory needed