Exemple #1
0
int
ncrecinq(
    int		ncid,
    int*	nrecvars,
    int*	recvarids,
    long*	recsizes
)
{
	size_t nrv = 0;
	size_t rs[NC_MAX_VARS]; /* TODO */
	const int status = nc_inq_rec(ncid, &nrv, recvarids, rs);
	if(status != NC_NOERR)
	{
		nc_advise("ncrecinq", status, "ncid %d", ncid);
		return -1;
	}

	if(nrecvars != NULL)
		*nrecvars = (int) nrv;

	if(recsizes != NULL)
	{
		size_t ii;
		for(ii = 0; ii < nrv; ii++)
		{
			recsizes[ii] = (long) rs[ii];
		}
	}

	return (int) nrv;
}
Exemple #2
0
int
ncrecinq(
    int		ncid,
    int*	nrecvars,
    int*	recvarids,
    long*	recsizes
)
{
	size_t nrv = 0;
	size_t *rs = NULL;
	int status = NC_NOERR;

	rs = (size_t*)malloc(sizeof(size_t)*NC_MAX_VARS);
	if(rs == NULL)
	    return NC_ENOMEM;

	status = nc_inq_rec(ncid, &nrv, recvarids, rs);
	if(status != NC_NOERR)
	{
		nc_advise("ncrecinq", status, "ncid %d", ncid);
		if(rs != NULL) free(rs);
		return -1;
	}

	if(nrecvars != NULL)
		*nrecvars = (int) nrv;

	if(recsizes != NULL)
	{
		size_t ii;
		for(ii = 0; ii < nrv; ii++)
		{
			recsizes[ii] = (long) rs[ii];
		}
	}

	if(rs != NULL) free(rs);

	return (int) nrv;
}