Using h5dump on the .h5 file, I see the following dataset:
GROUP "T" {
DATASET "CON" {
DATATYPE H5T_COMPOUND {
H5T_IEEE_F32LE "price";
H5T_STRING {
STRSIZE 1;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
} "label";
H5T_STD_I64LE "amount";
}
}
}
I have created the following data structure in C++:
class RawData
{
public:
float price;
char label[2];
long amount;
};
H5File file2(hdf5Source, H5F_ACC_RDONLY);
DataSet dataset = file2.openDataSet("/T/CON");
size_t size = dataset.getInMemDataSize();
RawData *s = (ExegyRawData*) malloc(size);
CompType type = dataset.getCompType();
dataset.read(s, type);
RawData r = s[0];
When I output RawData members, other than the price field, everything else are not recognizable. Can someone spot what is wrong with the code I have written above?