c++user-defined-data-types

How to convert different data-types to bytes in c++?


I have a structure that looks like:

typedef struct{
  float distance;
  float reflectivity;      
}data_point;

typedef struct{
  int flag;
  float Azimuth;
  data_point points[32];
}data_block;

enter image description here

enter image description here

How can I create a vector of 100 bytes of binary data? ( 2 + 2 + (32x3))?


Solution

  • You can either: