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.
------- Forwarded Message Date: Tue, 02 Aug 2005 21:00:01 +0200 From: Thomas Orgis <address@hidden> To: Russ Rew <address@hidden> cc: address@hidden Subject: Re: Bug with nc_inq_varid() in C interface? > > that it segfaults when trying to get the id to a non-existent > > I can't reproduce this problem. Could you try compiling and running I can't either! I also tried to reconstruct the bits of code that showed this behaviour, but they now also throw the error correctly... There was sth. like: if ( (nc_inq_varid(id, "time", &vars[0]) == NC_NOERR) && (nc_inq_varid(id, "lev", &vars[1]) == NC_NOERR) && (nc_inq_varid(id, "lat", &vars[2]) == NC_NOERR) && (nc_inq_varid(id, "lon", &vars[3]) == NC_NOERR) && (nc_inq_varid(id, "u", &vars[4]) == NC_NOERR) && (nc_inq_varid(id, "v", &vars[5]) == NC_NOERR) && (nc_inq_varid(id, "omega", &vars[6]) == NC_NOERR) ) { cerr << "[datagroup] variables there" << endl; //... } I don't have this project under version control... otherwise I could come up with something. I know that I testet with a file not containing omega and the program crashed before the stderr output line. Removing the last nc_inq line got the program through. I cannot tell anymore what kind of sideeffect (special condition) this has been. If I stumble over this again, I'll look closer... Bottom line: You're right. It works. Excuse me for the (most probably) false blame. -- Thomas Orgis, theoretischer Physiker - praktischer Mensch. Arbeitsgruppe Nichtlineare Dynamik Institut für Physik der Universität Potsdam ------- End of Forwarded Message