NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi, group, I am replying to a message I sent out a few days ago to another email list: > >NetCDF C++ library is compiled with: > >GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-85) > >Here is the sample code: > >#include <netcdfcpp.h> >#include <iostream> > >using namespace std; > >// g++ -o t testnccpp.cpp -lnetcdf_c++ -lnetcdf -L/usr/local/lib > >int main(void){ > > NcFile file("grid_spec.nc"); > > NcVar * geolon_t = file.get_var("geolon_t"); > > cout << "Type: " << geolon_t->type()<< endl; > for(int i = 0; i < geolon_t->num_dims(); i ++) > cout << i << ": " << geolon_t->get_dim(i)->size() << endl; > double x,y; > > if(geolon_t->get(&x, 10, 10)) > cout << x << endl; > if(geolon_t->get(&x, 10, 10)) > cout << x << endl; > file.close(); >} > >The wierd part is the program core dumps after the 2nd call >geolon_t->get(&x..., here is the output: > >Type: 6 >0: 200 >1: 360 >-279.5 >-279.5 >Segmentation fault (core dumped) > >I am seeking any clue/simiar experience as why the program core >dumps?.... > >-- >Fei Liu, PhD. phone: 609-4526551 >RSIS/GFDL/NOAA fax: 609-9875063 >P.O. Box 308, 201 Forrestal Rd. http://www.gfdl.noaa.gov/~fil >Princeton, NJ 08542-0308 email: Fei.Liu@xxxxxxxx > > >
netcdfgroup
archives: