Insert a named member into a enum type.
int nc_insert_enum(int ncid, nc_type xtype, const char *identifier,
const void *value);
ncidtypeididentifiervalueNC_NOERRNC_EBADIDNC_ENAMEINUSENC_EMAXNAMENC_EBADNAMENC_ENOTNC4NC_ESTRICTNC3NC_EHDFERRNC_ENOTINDEFINEThis example is from libsrc4/tst_enums.c; also see the example in See nc_def_enum.
char brady_name[NUM_BRADYS][NC_MAX_NAME + 1] = {"Mike", "Carol", "Greg", "Marsha",
"Peter", "Jan", "Bobby", "Whats-her-face",
"Alice"};
unsigned char brady_value[NUM_BRADYS] = {0, 1,2,3,4,5,6,7,8};
unsigned char data[BRADY_DIM_LEN] = {0, 4, 8};
unsigned char value_in;
/* Create a file. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
/* Create an enum type based on unsigned bytes. */
if (nc_def_enum(ncid, NC_UBYTE, BRADYS, &typeid)) ERR;
for (i = 0; i < NUM_BRADYS; i++)
if (nc_insert_enum(ncid, typeid, brady_name[i],
&brady_value[i])) ERR;