0

I am using Microsoft Visual Studio 2008 (HDF5 v1.8.12) and I have problems with each function a H5std_string as argument.


This is even the case when I run the example file "create.cpp" https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/c++/examples/create.cpp

This gives me the error: ....\H5F.c line 1466 in H5Fcreate(): invalid file name The error is fixed when I replace FILE_NAME with FILE_NAME.c_str() and DATASET_NAME with DATASET_NAME.c_str()


Similarily I get an error when running:

H5::Attribute attr = group.openAttribute("type");
H5std_string attr_content;
attr.read(attr.getStrType(), attr_content);

however following code works

char buf[1024];
H5::Attribute attr = group.openAttribute("type");
attr.read(attr_date.getStrType(), buf);
  • I think you should call `getDataType()` instead of `getStrType()` – user1 Oct 14 '15 at 11:22
  • using getDataType() does not help. The problem is purely related to using a stdstring. Functions using `char*` work fine, however I get an error whenever I use the corresponding function taking `H5std_string` as argument. – user2306172 Oct 16 '15 at 07:47
  • 2
    Looks similar to this answer: http://stackoverflow.com/questions/32072272/using-stdstring-in-hdf5-creates-unreadable-output – Ry Bobko Aug 23 '16 at 13:01

1 Answers1

0

The below shown error disappeared when switching in Visual Studio to Release-Mode.

Using std:: string in hdf5 creates unreadable output

Community
  • 1
  • 1