Creating attribute for root group

Hi all,

I’m trying to figure out how to create attributes for the root group - or any group at all, for that matter. The docs mention that both groups and datasets can have attributes attached to them, but the only examples I’ve seen attach the attributes to datasets. Perhaps I just give the group id as the first argument to h5acreate_f (I’m writing in F90). However, I don’t know what the group id for the root group would be.
Any help would be appreciated.


Jon, yes, you can create attributes on all groups, including the root group. You can obtain a group handle via h5gopen_f. To create an attribute on the root group, you can also pass the file handle as loc_id.


Thanks Gerd. I’ve written some test code and got it to work using the file handle to create metadata (i.e. attributes) at the top level.