Reading a string from hdf5 in C++

后端 未结 3 1660
有刺的猬
有刺的猬 2021-01-06 23:40

I am reading in datasets from a H5 file in Microsoft Visual C++ 2008. Everything works fine for data of type int and double but I run into problems when I come across string

3条回答
  •  感动是毒
    2021-01-07 00:11

    You need to allocate memory for the full strings, the library won't do it for you. You should replace

    char *buffer1[18];
    

    by

    char buffer1[18][24];
    

    and

    datasetCurveNames.read(&buffer1, strdatatype);
    

    should be

    datasetCurveNames.read(buffer1, strdatatype);
    

    (no &)

提交回复
热议问题