-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Milestone
Description
When I try to read a fixed-size string attribute with properties (from h5dump -e -a ...) like
ATTRIBUTE "Creator" {
DATATYPE H5T_STRING {
STRSIZE 7;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
(0): "xxxxxx"
}
}
using code like
std::string value;
attribute.read(value);
the resulting std::string value contains the terminating '\0' character as last character in its internal vector of characters.
I found the related issue #224, and am now unsure if this is intended behavior. I personally find this behavior rather odd and not really conforming to what I expected from an interface storing a string attribute into a std::string.
PS: Reading the same attribute but stored as non-fixed-size string in the hdf5 file
ATTRIBUTE "Creator" {
DATATYPE H5T_STRING {
STRSIZE H5T_VARIABLE;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
(0): "xxxxxx"
}
}
using the same c++ code, works as expected (i.e., no trailing \0 in the resulting std::string).
Metadata
Metadata
Assignees
Labels
No labels