Next: NF_INQ_LIBVERS, Previous: NetCDF Library Interface Descriptions, Up: Datasets
The function NF_STRERROR returns a static reference to an error message string corresponding to an integer netCDF error status or to a system error number, presumably returned by a previous call to some other netCDF function. The list of netCDF error status codes is available in the appropriate include file for each language binding.
CHARACTER*80 FUNCTION NF_STRERROR(INTEGER NCERR)
NCERR
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), NF_STRERROR returns a string indicating that there is no such error status.
Here is an example of a simple error handling function that uses NF_STRERROR to print the error message corresponding to the netCDF error status returned from any netCDF function call and then exit:
INCLUDE 'netcdf.inc' ... SUBROUTINE HANDLE_ERR(STATUS) INTEGER STATUS IF (STATUS .NE. NF_NOERR) THEN PRINT *, NF_STRERROR(STATUS) STOP 'Stopped' ENDIF END