Calixte, how are you? It's the latter. The documentation is not very precise
on this,
but HDF5 links aren't HDF5 objects. See section '1.2.2 Group', Figures 5 and
6 in the HDF5 User Guide.

http://www.hdfgroup.org/HDF5/doc/UG/

The H5L interface has several functions for inspecting HDF5 links.

Best, G.

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Calixte Denizet
Sent: Wednesday, September 12, 2012 2:19 PM
To: [email protected]
Subject: [Hdf-forum] Error with H5Oget_info_by_idx on soft links

Hi,

I don't understand why the following code returns an error (hdf5 version is
1.8.8 with Debian testing):

#include <hdf5.h>
#include <stdio.h>

int main(int argc, char ** argv)
{
     hid_t file = H5Fcreate("/tmp/plop.h5", H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT);
     H5Lcreate_soft("abc", file, "def", H5P_DEFAULT, H5P_DEFAULT);
     H5Fclose(file);

     file = H5Fopen("/tmp/plop.h5", H5F_ACC_RDONLY, H5P_DEFAULT);
     hid_t root = H5Gopen2(file, "/", H5P_DEFAULT);
     H5G_info_t info;
     herr_t err = H5Gget_info(root, &info);
     hsize_t i = 0;

     printf("nlinks=%i\n", info.nlinks);

     for (; i < info.nlinks; i++)
     {
     H5O_info_t objinfo;
     err = H5Oget_info_by_idx(root, ".", H5_INDEX_NAME, H5_ITER_INC, i,
&objinfo, H5P_DEFAULT);
     printf("addr=%u\n", objinfo.addr);
     }

     H5Gclose(root);
     H5Fclose(file);

     return 0;
}

Is it a bug ? or is a link not an object ?

Thanks

Calixte

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org



_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to