stdstring和hdf5的问题

Problems with stdstring and hdf5

本文关键字:问题 hdf5 stdstring      更新时间:2023-10-16

我正在使用Microsoft Visual Studio 2008 (HDF5 v1.8.12),我对H5std_string作为参数的每个函数都有问题。


甚至当我运行示例文件"create.cpp"时也是如此。https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/c + +/例子/create.cpp

这给了我错误:.... h5fc在H5Fcreate()中的第1466行:无效的文件名当我用FILE_NAME.c_str()替换FILE_NAME时,错误是固定的DATASET_NAMEDATASET_NAME.c_str()


类似地,当运行 时,我得到一个错误:
H5::Attribute attr = group.openAttribute("type");
H5std_string attr_content;
attr.read(attr.getStrType(), attr_content);

但是下面的代码可以工作

char buf[1024];
H5::Attribute attr = group.openAttribute("type");
attr.read(attr_date.getStrType(), buf);

在Visual Studio切换到发布模式时,下面显示的错误消失了。

在hdf5中使用std:: string会产生不可读的输出