Closed bendiy closed 5 years ago
You can confirm the existence of the group using H5L.exists()
like I did here. I am not sure right now if you need a preceding forward slash. So maybe this will work:
H5G.info_t info = new H5G.info_t();
long gid = -1;
if (H5L.exists(myFileId, "/my_group_name_here") == 0)
{
gid = H5G.get_info_by_name(myFileId, "/my_group_name_here", ref info);
}
Printing the default error stack (of the native library) is turned on by default. You can turn it off via H5E.set_auto
. See https://support.hdfgroup.org/HDF5/doc/RM/RM_H5E.html#Error-SetAuto2
@gheber Thanks!
Just circling back around to this. I added the following to my code and it appears to silence the redundant errors I was seeing.
H5E.set_auto(H5E.DEFAULT, null, IntPtr.Zero);
When running this code:
I get this error in the console:
The code does continue to run and works fine. Is this error some kind of debug message?
Docs say: https://support.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetInfoByName
I didn't expect to see the error in the console when checking for a Group that doesn't exist. Only a negative value for
gid
.