【发布时间】:2016-01-12 09:35:41
【问题描述】:
我正在使用 Microsoft Visual Studio 2008 (HDF5 v1.8.12),但每个函数都使用 H5std_string 作为参数存在问题。
当我运行示例文件“create.cpp”时也是如此 https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/c++/examples/create.cpp
这给了我错误:
....\H5F.c H5Fcreate() 中的第 1466 行:文件名无效
当我将 FILE_NAME 替换为 FILE_NAME.c_str() 时,该错误已修复
和DATASET_NAME 和DATASET_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);
【问题讨论】:
-
我认为你应该打电话给
getDataType()而不是getStrType() -
使用 getDataType() 没有帮助。该问题纯粹与使用标准字符串有关。使用
char*的函数可以正常工作,但是每当我使用以H5std_string作为参数的相应函数时都会出错。 -
看起来类似于这个答案:stackoverflow.com/questions/32072272/…
标签: c++ visual-c++ hdf5 stdstring