This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: address@hidden >From: Michael Dixon <address@hidden> >Subject: netCDF C++ interface >Organization: NCAR/RAP >Keywords: 200112312242.fBVMg3N20826 netCDF C++ Mike, In my previous reply, I forgot to answer your last question: > Perhaps it would be worth adding a strerror() type function to > the error class? Or do you have suggestions on how best to use > the NcError class? The default behavior of the error class is NcError::verbose_fatal, which means if you don't even bother with checking error returns, any error detected will result in an error message being written to stderr and termination. Sort of like the behavior when you don't catch an exception. The intention was to modify this behavior when you want to handle errors yourself by declaring an NcError object with a different behavior. For example, if there is a section of your program where you are checking netCDF attributes and expect an attribute might not exist, you could wrap it in something like: { NcError* xerror = new NcError(NcError::silent_nonfatal); ... NcAtt* testatt = P->get_att("some_attribute"); if (testatt == 0) { // handle nonexistence of attribute } ... } --Russ