Page tree









Retrieves name of file to which object belongs


H5F_GET_NAME (obj_id, name, size)


ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size )

SUBROUTINE h5fget_name_f(obj_id, buf, size, hdferr)

  INTEGER(HID_T), INTENT(IN) :: obj_id     ! Object identifier 
  CHARACTER(LEN=*), INTENT(INOUT) :: buf   ! Buffer to hold file name
  INTEGER(SIZE_T), INTENT(OUT) :: size     ! Size of the file name
  INTEGER, INTENT(OUT) :: hdferr           ! Error code: 0 on success,
                                           ! -1 if fail
END SUBROUTINE h5fget_name_f

hid_t obj_id

IN: Identifier of the object for which the associated file name is sought; may be a file, group, dataset, attribute, or named datatype

char *nameOUT: Buffer to contain the returned file name
size_t size

IN: Size, in bytes, of the name buffer


H5F_GET_NAME retrieves the name of the file to which the object obj_id belongs. The object can be a file, group, dataset, attribute, or named datatype.

Up to size characters of the file name are returned in name; additional characters, if any, are not returned to the user application.

If the length of the name, which determines the required value of size, is unknown, a preliminary H5F_GET_NAME call can be made by setting name to NULL. The return value of this call will be the size of the file name; that value plus one (1) can then be assigned to size for a second H5F_GET_NAME call, which will retrieve the actual name. (The value passed in with the parameter size must be one greater than size in bytes of the actual name in order to accommodate the null terminator; if size is set to the exact size of the name, the last byte passed back will contain the null terminator and the last character will be missing from the name passed back to the calling application.)

If an error occurs, the buffer pointed to by name is unchanged and the function returns a negative value.


Returns the length of the file name if successful; otherwise returns a negative value.


Coming soon!

Release    Change
1.6.3C Function introduced in this release.
Fortran subroutine introduced in this release.

--- Last Modified: December 20, 2018 | 11:18 AM