Hello!
To reproduce:
-
Compile and run attached
test727.c (730 Bytes) -
It worked just fine, as confirmed by
h5dump test.h5
:
HDF5 "test.h5" {
GROUP "/" {
ATTRIBUTE "key" {
DATATYPE H5T_STRING {
STRSIZE 4;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
(0): "123"
}
}
}
}
However according to docs, it should have failed:
The size set for a string datatype should include space for the null-terminator character, otherwise it will not be stored on (or retrieved from) disk
It is proposed to fix incorrect/inaccurate description.
Originally reported in Writing a string does not include NULL terminator · Issue #727 · h5py/h5py · GitHub.
Best wishes,
Andrey Paramonov