Previous: , Up: Files   [Index]


2.28 Reports the number of files that are currently opened: ncmpi_inq_files_opened

The function ncmpi_inq_files_opened reports the number of files and their IDs that are currently opened.

Operational Mode

This API is an independent subroutine.

Usage

int ncmpi_inq_files_opened(int *num,
                           int *ncids);
num

[Output] number of files. This argument cannot be NULL.

ncids

[Output] array of netCDF IDs, each corresponding to an opened file. This argument can be NULL.

Return Error Codes

ncmpi_inq_files_opened returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:

Example

Here is an example using ncmpi_inq_files_opened.

#include <pnetcdf.h>
   ... 
int status, num, *ncids;
   ...
/* inquire the number of file opened */
status = ncmpi_inq_files_opened(&num, NULL);
if (status != NC_NOERR) handle_error(status);

/* allocate ncids array */
ncids = malloc(num * sizeof(int);

/* inquire the list of ncids */
status = ncmpi_inq_files_opened(&num, ncids);
if (status != NC_NOERR) handle_error(status);

Previous: , Up: Files   [Index]