Last modified: 9 October 2014
Name: H5Acreate2
Signature:
hid_t H5Acreate2( hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, )

Purpose:
Creates an attribute attached to a specified object.

Description:
H5Acreate2 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 codes), which defaults to 1 character in size. See H5Tset_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 H5Aclose or resource leaks will develop.

Parameters:
hid_t loc_id IN: Location or object identifier
May be any HDF5 object identifier (group, dataset, or committed datatype) or an HDF5 file identifier; if loc_id is a file identifer, the attribute will be attached to that file’s root group.
const char *attr_name     IN: Attribute name
hid_t type_id IN: Attribute datatype identifier
hid_t space_id IN: Attribute dataspace identifier
hid_t acpl_id IN: Attribute creation property list identifier
(Currently not used; specify H5P_DEFAULT.)
hid_t aapl_id IN: Attribute access property list identifier
(Currently not used; specify H5P_DEFAULT.)

Returns:
Returns an attribute identifier if successful; otherwise returns a negative value.

Fortran90 Interface:
See listing under H5Acreate.

See Also:
H5Tset_size
Creating variable-length string datatypes
“Using Identifiers”

History:
Release     Change
1.8.0 C function introduced in this release.