Hello,
I would like to read array data from my HDF files. I use C++ code for reading the array dimension, for matrix and vector data (double / float) everything works fine, also a native string. I have created a hdf string array with Matlab and try to read it with C++:
H5::DataSet l_dataset = m_file.openDataSet( p_path.c_str() );
H5::DataSpace l_dataspace = l_dataset.getSpace();
if (l_dataspace.getSimpleExtentNdims() != 1)
throw exception
if (!l_dataspace.isSimple())
throw exception
hsize_t l_size[1];
l_dataspace.getSimpleExtentDims( l_size );
char l_data[l_size[0]];
l_dataset.read( l_data, l_dataset.getDataType() );
l_size[0] holds the number of items of my string array, but how can I read now the data? I take a look to http://www.hdfgroup.org/training/other-ex5/#dtypes the "creating/reading variable length string dataset C++" excample, but this code doesn't work. I'll get a segmentation fault on the dataset.read option, that I change the char* zu char. In the l_data variable I see some items of the first array element.
Can anyone explain me how I read the data in the correct way?
Thanks
Phil