How to know what is in a H5 file


I use the H5 library in a C program to read H5 files. But I need to know what is in my file (groups, datasets…)
I check over internet and found theses functions:

/* Open an existing file. */
    file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);

    hid_t gid = H5Groot(file_id);
    char name[256];
    int num_objects;
    while (H5Gnext(gid, &name, &num_objects) != H5G_ERROR_END) {
        printf("%s\n", name);

But for my compiler (visual studio 2019) H5Groot,H5Gnext and H5G_ERROR_END are not defined.
I tried to found the definition in the different source file of the H5fd library with no success
I also check the H5FD library documentation ( but it seems theses functions are not described
So if any one has already successfully used these functions please let me know how you did.

Those H5G APIs are not valid; maybe some AI model hallucination?

If you are just interested in seeing the contents of the hdf5 file, you can use HDF5 tools h5ls and h5dump, or use the hdfview,

If you are interested in getting that information from inside your code, take a look at the examples:

1 Like

Yes I was interested in getting informations inside my code.
I tried your solution and it’s work