All,
I am creating a string datatype as given below
hid_t stringType = H5Tcopy(H5T_C_S1);
H5Tset_size(stringType,H5T_VARIABLE);
H5Tset_strpad(stringType,H5T_STR_NULLTERM );
and then creating a dataset which consists of the above datatype
I want to write 2 strings into this dataset . One of them is "HELLO"
and the other one is a blank string " " .
The write is done as given below
char* str[1];
str[0]=new char[6];
strcpy(str[0],"HELLO");
status = H5Dwrite(dataset, type, memspace, dspace, H5P_DEFAULT,
&str[0]);
delete[] str[0];
str[0]=new char[2];
strcpy(str[0]," ");
status = H5Dwrite(dataset, type, memspace, dspace, H5P_DEFAULT,
&str[0]);
The elements are written properly into the dataset .
The problem comes while reading . I am able to read back the first entry
in the dataset ( i.e. the string "HELLO" ) . When I try to read the
second element of the dataset I get this assertion
Assertion failed: buf, file ..\..\src\H5Tvlen.c, line 826 .
If there is any mistake on my part in the way I am writing a blank
string please let me know the correct way of doing this . I am using
hdf51.6.5 .
Thanks and Regards
Ramakrishnan