[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: segment fault



Vivian,

> I get the following error when I try to get a string out of the netcdf file.
> >From the debugger (softdebug), I believe it is crashing inside of the
> for (i ...) loop in the NcVar::get function, but I'm not sure.  Is there
> something I forgot to do in setting up the netcdf package or is it something
> else?
> 
> 
> Stepped to: 
> \\netcdf\`amb(NcVar::get,char*,long,long,long,long,long)\ub.1\ub.2\ub.3\627+14
>  (000790D4)
> Intercepted event type 'signal SIGSEGV'.
> Stopped at: xdr_NCvbyte (00083584)
> 
> my function call looks like this:
>  if ( !var->get(  _tempStr, numSta, (long) ProfilerLapsReport::STANAMELEN ) )
>                 return false;
> 
> Comment:  _tempStr is a char*, numSta is a long == 4 in this case, and
>       ProfilerLapsReport::STANAMELEN is an enum == 6.  Oh and var is the
>       name of an NcVar*

I suspect you didn't initialize tempStr, or it doesn't point to enough space
to hold the value, which according to the arguments you've provided will be
of length 
           
    numSta * ProfilerLapsReport::STANAMELEN.

bytes.

--Russ

______________________________________________________________________________

Russ Rew                                           UCAR Unidata Program
address@hidden                              http://www.unidata.ucar.edu