Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2025-11-11 The HDF5 Field Guide

- Main Page
- Getting started
- User Guide
- Reference Manual
- Cookbook
- Technical Notes
- RFCs
- Specifications
- Glossary
- Full-Text Search
- About

Loading...
Searching...
No Matches
Topics | Functions
Compound and Enumeration Datatypes
Datatypes (H5T)

## Detailed Description

## Topics
| Compound Datatypes
| Enumeration Datatypes

## Functions
int | H5Tget_member_index (hid_t type_id, const char *name)
| Retrieves the index of a compound or enumeration datatype member.
char * | H5Tget_member_name (hid_t type_id, unsigned membno)
| Retrieves the name of a compound or enumeration datatype member.
int | H5Tget_nmembers (hid_t type_id)
| Retrieves the number of elements in a compound or enumeration datatype.

## Function Documentation

## ◆ H5Tget_member_index()

int H5Tget_member_index | ( | hid_t | type_id,
|  | const char * | name )

Retrieves the index of a compound or enumeration datatype member.

Parameters

  [in] | type_id | Datatype identifier
  [in] | name | Name of the field or member

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

H5Tget_member_index() retrieves the index of a field of a compound datatype or an element of an enumeration datatype.

The name of the target field or element is specified by `name`.

Fields are stored in no particular order with index values of 0 through N-1, where N is the value returned by H5Tget_nmembers() .

Since
  1.4.0

## ◆ H5Tget_member_name()

char * H5Tget_member_name | ( | hid_t | type_id,
|  | unsigned | membno )

Retrieves the name of a compound or enumeration datatype member.

Parameters

  [in] | type_id | Datatype identifier
  [in] | membno | Zero-based index of the field or element

Returns
  Returns a valid pointer to a string allocated with malloc() if successful; otherwise returns NULL.

H5Tget_member_name() retrieves the name of a field of a compound datatype or an element of an enumeration datatype.

The index of the target field or element is specified in `member_no`. Compound datatype fields and enumeration datatype elements are stored in no particular order with index values of 0 through N-1, where N is the value returned by H5Tget_nmembers().

The HDF5 library allocates a buffer to receive the name of the field. The caller must subsequently free the buffer with H5free_memory().

Since
  1.0.0

## ◆ H5Tget_nmembers()

int H5Tget_nmembers | ( | hid_t | type_id | ) |

Retrieves the number of elements in a compound or enumeration datatype.

Parameters

  [in] | type_id | Datatype identifier

Returns
  Returns the number of elements if successful; otherwise returns a negative value.

H5Tget_nmembers() retrieves the number of fields in a compound datatype or the number of members of an enumeration datatype.

Since
  1.0.0