Page tree









Sets the total size for a datatype


H5T_SET_SIZE (dtype_id, size)


herr_t H5Tset_size( hid_t dtype_id, size_t size )

SUBROUTINE h5tset_size_f(type_id, size, hdferr) 
  INTEGER(HID_T), INTENT(IN) :: type_id  ! Datatype identifier 
  INTEGER(SIZE_T), INTENT(IN) :: size    ! Datatype size
  INTEGER, INTENT(OUT) :: hdferr         ! Error code
                                         ! 0 on success and -1 on failure
END SUBROUTINE h5tset_size_f

hid_t dtype_id    IN: Identifier of datatype for which the size is being changed
size_t sizeIN: New datatype size in bytes or H5T_VARIABLE


 H5T_SET_SIZE sets the total size in bytes, size, for a datatype.

The parameter size must have a positive value, unless it is passed as H5T_VARIABLE and the datatype is a string datatype.

Numeric datatypes: If the datatype is atomic and the size is decreased so that significant bits of the datatype extend beyond the edge of the new size, then the offset property of the datatype is decreased toward zero. If the offset becomes zero and the significant bits of the datatype still hang over the edge of the new size, then the number of significant bits is decreased.

String or character datatypes: The size set for a string datatype should include space for the null-terminator character, otherwise it will not be stored on (or retrieved from) disk. Adjusting the size of a string automatically sets the precision to 8*size.

Variable-length string datatypes: If dtype_id is a variable-length string, size must normally be set to H5T_VARIABLE. See “Creating variable-length string datatypes”.

Compound datatypes: This function may be used to increase or decrease the size of a compound datatype, but the function will fail if the new size is too small to accommodate all member fields.

Ineligible datatypes: This function cannot be used with enumerated datatypes (H5T_ENUM), array datatypes (H5T_ARRAY), variable-length array datatypes (H5T_VLEN), or reference datatypes (H5T_REFERENCE).


Returns a non-negative value if successful; otherwise returns a negative value.


Coming Soon!

--- Last Modified: January 08, 2020 | 12:29 PM