Re: Segmentation Fault when modifying string variables

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Jul 30 2010 - 09:19:36 MDT

Hi Jeff,

Do you know exactly which line the seg fault happens on?

If you comment out the main "begin" and "end" in your code (if you have them),
and run your script with "ncl -x", this will echo every line as it is executed,
and you will see where the seg fault occurs.

I think that you might need to make "x" dimensioned 1 x 20, because there's
a special "end-of-line" character needed when you go from a string to
a character array.

Your timestamp variables are exactly 19 characters, so see if the following helps:

              x = new((/1,20/),character)

--Mary

On Jul 30, 2010, at 7:20 AM, Jeff wrote:

> timestamp0 = "2001-01-01_00:00:00"
> timestamp = "2001-01-01_01:00:00"
>
> fin = "wrfchemi_d01_"+timestamp0
> fon = "wrfchemi_d01_"+timestamp
>
> system("ln -sf "+fin+" "+fon)
>
> x = new((/1,19/),character)
> tmp = stringtocharacter(timestamp)
> x(0,:) = tmp(0:dimsizes(tmp)-2)
>
> f = addfile(fon+".nc","w")
> f->Times = (/x/)
>
> delete(timestamp)
> delete(timestamp0)
> delete(tmp)
> delete(x)
> ======

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jul 30 09:19:43 2010

This archive was generated by hypermail 2.1.8 : Tue Aug 03 2010 - 15:09:38 MDT