Writes data to an attribute
Procedure:
H5A_WRITE(attr_id, mem_type_id, buf)
Signature:
herr_t H5Awrite
(
hid_t attr_id,
hid_t mem_type_id,
const void *buf
)
Fortran90:
SUBROUTINE h5awrite_f(attr_id, memtype_id, buf, dims, hdferr)
INTEGER(HID_T) , INTENT(IN) :: attr_id
INTEGER(HID_T) , INTENT(IN) :: memtype_id
TYPE , INTENT(IN) :: buf
INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims
INTEGER , INTENT(OUT) :: hdferr
Fortran2003:
SUBROUTINE h5awrite_f(attr_id, memtype_id, buf, hdferr)
INTEGER(HID_T) , INTENT(IN) :: attr_id
INTEGER(HID_T) , INTENT(IN) :: memtype_id
TYPE(C_PTR) , INTENT(IN) :: buf
INTEGER , INTENT(OUT) :: hdferr
Parameters:
hid_t attr_id | IN: Identifier of an attribute to write |
hid_t mem_type_id | IN: Identifier of the attribute datatype (in memory) |
const void * buf | IN: Data to be written |
Description:
H5A_WRITE writes an attribute, specified with attr_id
. The attribute's memory datatype is specified with mem_type_id
. The entire attribute is written from buf
to the file.
If mem_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 H5T_SET_SIZE and Creating variable-length string datatypes.
Datatype conversion takes place at the time of a read or write and is automatic. See the “Data Transfer: Datatype Conversion and Selection” section in the “HDF5 Datatypes” chapter of the HDF5 User’s Guide for a discussion of data conversion.
Returns:
Returns a non-negative value if successful; otherwise returns a negative value.
Example:
History:
Release | Change |
---|
1.8.8 | Fortran updated to Fortran2003. |
1.4.2 | Fortran dims parameter added in this release. |
--- Last Modified: December 20, 2018 | 02:09 PM