Next: nc_inq_varids, Previous: nc_inq_ncid, Up: Groups
Given a location id, return the number of groups it contains, and an array of their ncids.
int nc_inq_grps(int ncid, int *numgrps, int *ncids);
ncidnumgrpsncidsNC_NOERRNC_EBADIDNC_ENOTNC4NC_ESTRICTNC3NC_EHDFERR int root_ncid, numgrps;
int *ncids;
char file[] = "nc4_test.nc";
/* Open the file. */
if ((res = nc_open(file, NC_NOWRITE, &root_ncid)))
return res;
/* Get a list of ncids for the root group. (That is, find out of
there are any groups already defined. */
if ((res = nc_inq_grps(root_ncid, &numgrps, NULL)))
return res;
ncids = malloc(sizeof(int) * numgrps);
if ((res = nc_inq_grps(root_ncid, NULL, ncids)))
return res;