5.27 Creating Opaque Types: nc_def_opaque
Create an opaque type. Provide a size and a name.
Usage
nc_def_opaque(int ncid, const char *name, size_t size, nc_type *typeidp);
ncid
- The groupid where the type will be created. The type may be used
anywhere in the file, no matter what group it is in.
name
- The name for this type. Must be shorter than NC_MAX_NAME.
size
- The size of each opaque object.
typeidp
- Pointer where the new typeid for this type is returned. Use this
typeid when defining variables of this type with nc_def_var.
Errors
NC_NOERR
- No error.
NC_EBADTYPEID
- Bad typeid.
NC_EBADFIELDID
- Bad fieldid.
NC_EHDFERR
- An error was reported by the HDF5 layer.
Example
This example is from the test program libsrc4/tst_opaques.c.
/* Create a file that has an opaque attribute. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_def_opaque(ncid, BASE_SIZE, TYPE_NAME, &xtype)) ERR;