-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Running
#include <h5cpp/hdf5.hpp>
#include <h5cpp/datatype/string.hpp>
#include <h5cpp/datatype/types.hpp>
int main()
{
using namespace hdf5;
file::File f = file::create("myscan_test.nxs", file::AccessFlags::Truncate);
node::Group root_group = f.root();
// auto scalar_space = dataspace::Scalar();
// auto string_type = datatype::String::variable();
// string_type.encoding(datatype::CharacterEncoding::ASCII);
// auto a = root_group.attributes.create("asciiattr", string_type, scalar_space);
// a.write("m");
auto scalar_space2 = dataspace::Scalar();
auto string_type2 = datatype::String::variable();
string_type2.encoding(datatype::CharacterEncoding::UTF8);
auto a2 = root_group.attributes.create("utf8attr", string_type2, scalar_space2);
// a2.write("um", string_type2);
a2.write("um");
}
one get
HDF5-DIAG: Error detected in HDF5 (1.10.8) thread 1:
#000: ../../../src/H5A.c line 614 in H5Awrite(): unable to write attribute
major: Attribute
minor: Write failed
#001: ../../../src/H5Aint.c line 724 in H5A__write(): unable to convert between src and dst datatypes
major: Attribute
minor: Feature is unsupported
#002: ../../../src/H5T.c line 4799 in H5T_path_find(): can't find datatype conversion path
major: Datatype
minor: Can't get value
#003: ../../../src/H5T.c line 5021 in H5T__path_find_real(): no appropriate function for conversion path
major: Datatype
minor: Unable to initialize object
terminate called after throwing an instance of 'std::runtime_error'
what(): Failure to write data to attribute!
Aborted
To make the above code working one can either uncomment a2.write("um", string_type2); or a block of instructions related to a.write("m") i.e. ASCII string
Metadata
Metadata
Assignees
Labels
No labels