IN: Location or object identifier The identifier may be a file, group, dataset, or named datatype. If loc_id is a file identifier, the attribute will be attached to that file’s root group.
const char *attr_name
IN: Attribute name
IN: Attribute datatype identifier
IN: Attribute dataspace identifier
IN: Attribute creation property list identifier (Currently not used; specify H5P_DEFAULT)
IN: Attribute access property list identifier (Currently not used; specify H5P_DEFAULT)
H5A_CREATE2 creates an attribute, attr_name, which is attached to the object specified by the identifier loc_id.
The attribute name, attr_name, must be unique for the object.
The attribute is created with the specified datatype and dataspace, type_id and space_id, which are created with the H5T and H5S interfaces, respectively.
If type_id is either a fixed-length or variable-length string, it is important to set the string length when defining the datatype. String datatypes are derived from H5T_C_S1 (or H5T_FORTRAN_S1 for Fortran), which defaults to 1 character in size. See H5T_SET_SIZE and Creating variable-length string datatypes.
The access property list is currently unused, but will be used in the future. This property list should currently be H5P_DEFAULT.
The attribute identifier returned by this function must be released with H5A_CLOSE or resource leaks will develop.
Returns an attribute identifier if successful; otherwise returns a negative value.