Next: ncmpi_inq_libvers, Previous: ncmpi_strerror, Up: Files [Index]
The function ncmpi_strerrno returns a character string containing the name of the NC error code. For instance, ncmpi_strerrno(NC_EBADID) returns string "NC_EBADID".
This API is not associated to any opened file and hence can be called anytime.
const char * ncmpi_strerrno(int ncerr);
ncerr
An error status that might have been returned from a previous call to some PnetCDF function.
If you provide an invalid integer error status that does not correspond to any netCDF error message or or to any system error message (as understood by the system strerror function), ncmpi_strerrno returns a string indicating that there is no such error status.
Here is an example of a simple error handling function that uses ncmpi_strerrno to print the error code name of a netCDF error code returned from any PnetCDF function call.
#include <pnetcdf.h> ... void handle_error(int err) { if (err != NC_NOERR) { fprintf(stderr, "NC error code name: %s\n", ncmpi_strerrno(err)); MPI_Abort(MPI_COMM_WORLD, -1); } }
Next: ncmpi_inq_libvers, Previous: ncmpi_strerror, Up: Files [Index]