Next: Compound Types, Previous: nc_inq_type, Up: User Defined Data Types
Given an ncid and a typeid, get the information about a user defined type. This function will work on any user defined type, whether compound, opaque, enumeration, or variable length array.
nc_inq_user_type(int ncid, nc_type xtype, char *name, size_t *sizep,
nc_type *base_nc_typep, size_t *nfieldsp, int *classp);
ncidxtypenamesizepbase_nc_typepnfieldspclasspNC_NOERRNC_EBADTYPEIDNC_EBADFIELDIDNC_EHDFERR /* Create a file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
/* Create an enum type. */
if (nc_def_enum(ncid, NC_INT, TYPE_NAME, &typeid)) ERR;
for (i = 0; i < NUM_MEMBERS; i++)
if (nc_insert_enum(ncid, typeid, member_name[i],
&member_value[i])) ERR;
/* Check it out. */
if (nc_inq_user_type(ncid, typeid, name_in, &base_size_in, &base_nc_type_in,
&nfields_in, &class_in)) ERR;
if (strcmp(name_in, TYPE_NAME) || base_size_in != sizeof(int) ||
base_nc_type_in != NC_INT || nfields_in != NUM_MEMBERS || class_in != NC_ENUM) ERR;