Next: , Previous: nc_inq_dimids, Up: Groups


3.5 Find a Group's Name: nc_inq_grpname

Given a group ID find its name. (Root group is named "/"). See nc_inq_grpname_full.

Usage

     int nc_inq_grpname(int ncid, char *name);
ncid
The group id for this operation.
name
Pointer to allocated space of correct length. The name of the group will be copied there. The name will be less than NC_MAX_NAME, not including a terminating NULL byte.

Errors

NC_NOERR
No error.
NC_EBADID
Bad group id.
NC_ENOTNC4
Attempting a netCDF-4 operation on a netCDF-3 file. NetCDF-4 operations can only be performed on files defined with a create mode which includes flag HDF5. (see nc_open).
NC_ESTRICTNC3
This file was created with the strict netcdf-3 flag, therefore netcdf-4 operations are not allowed. (see nc_open).
NC_EHDFERR
An error was reported by the HDF5 layer.

Example

This example is from libsrc4/tst_grps.c.

           int grpid_in[MAX_SIBLING_GROUPS];
           char name_in[NC_MAX_NAME + 1];
     
           ...
     
           if (nc_inq_grpname(grpid_in[0], name_in)) ERR;