aboutsummaryrefslogtreecommitdiff
path: root/src/H5IO.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5IO.cc')
-rw-r--r--src/H5IO.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/H5IO.cc b/src/H5IO.cc
index d5d8795..d52ac2b 100644
--- a/src/H5IO.cc
+++ b/src/H5IO.cc
@@ -629,6 +629,12 @@ int H5IO::readAttribute(int number,void *data){
hid_t attrib = H5Aopen_idx(dataset,number);
hid_t atype = H5Aget_type(attrib);
H5Aread(attrib,atype /*DataType2H5(H5DataType2DataType(atype))*/ ,data);
+ // need to explicitely set the terminating NUL character in string attributes
+ if (H5Tget_class (atype) == H5T_STRING)
+ {
+ size_t len = H5Tget_size (atype);
+ ((char *) data)[len] = 0;
+ }
H5Tclose(atype);
H5Aclose(attrib);
return 1;