Hello
I'm quite novice with HDF5 could you help me with attached code, i've used
sample codes, but unfortunately they do not work. Free memory for read
buffer causes exception. What is the best method to free memory? My version
of HDF is 1.8.9. Than you.
Exception::dontPrint();
H5File file( "filecpp.h5", H5F_ACC_TRUNC );
hsize_t dimsf[2]; // dataset dimensions
dimsf[0] = 5;
dimsf[1] = 5;
DataSpace dataspace( 2, dimsf );
IntType datatype( PredType::NATIVE_INT );
datatype.setOrder( H5T_ORDER_LE );
DataSet dataset = file.createDataSet("my dataset", datatype, dataspace
);
StrType strArrType(PredType::C_S1,H5T_VARIABLE);
hsize_t dims[]={4};
const char *string_att[4] = {"string1",
"str2",
"strings123",
"str45"};
char* readStr[4];
DataSpace dataspace2(1,dims);
Attribute attr2=dataset.createAttribute("stringArray",
strArrType,
dataspace2);
attr2.write(strArrType, string_att);
attr2.read(strArrType, readStr);
for (int i=0; i<4; i++)
free(readStr[i]); //causes exception
file.close();
--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/free-memory-for-variable-length-types-tp4025565.html
Sent from the hdf-forum mailing list archive at Nabble.com.
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org