Hi,
I have a dataset "dataset_label" in a hdf5 file format which contains a
string of N elements equals to "None\0". I read the dataset using hdf5 C++
API:
hid_t datatype = H5Tcopy (H5T_C_S1);
H5Tset_size (datatype, H5T_VARIABLE);
H5::DataType dtype = dataset_label.getDataType();
dataset_label.read(h5_data->label ,dtype ,memspace_l, dataspace_l);
I then replace "None\0" with a variable length strings(ranging from 3-35
chars in each end with null terminator) in char* Label_buf and want to
over-write these new strings in the dataset, but when I use the c++ example
varlen.cpp :
H5::StrType tid1(0, H5T_VARIABLE);
dataset_label.write((void*)Label_buf,tid1);
I get a run-time error as follows:
HDF5-DIAG: Error detected in HDF5 (1.8.6) thread 0:
#000: H5Dio.c line 266 in H5Dwrite(): can't write data
major: Dataset
minor: Write failed
#001: H5Dio.c line 541 in H5D_write(): unable to set up type info
major: Dataset
minor: Unable to initialize object
#002: H5Dio.c line 836 in H5D_typeinfo_init(): unable to convert between
src and dest datatype
major: Dataset
minor: Feature is unsupported
#003: H5T.c line 4449 in H5T_path_find(): no appropriate function for
conversion path
major: Datatype
minor: Unable to initialize object
if I do
H5::DataType dtype = dataset_label.getDataType();
dataset_label.read(h5_data->label ,dtype ,memspace_l, dataspace_l);
it doesn't throw an error but the written string in the dataset is totally
messed-up.
Can anyone please tell me what is the write way to over-write my
variable-length strings or any alternative?
Thank you so much in advance
Sahar
--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/over-writing-variable-length-string-in-dataset-using-hdf5-C-API-tp3219658p3219658.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