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

Re: taming the shrew, a.k.a. structure



HILBERMAN writes:
> 
> To put it simply, you rock.  I have now successfully created a mess: an
> array of a structure
> that contains another embedded structure.  Unfortunately, I'm still not
> 'pointed' in the right
> direction.  When I try to apply the pointer tip to 'the mess' I get the
> error:
> % Conflicting data structures: <POINTER  (<NullPointer>)>,MONTH_STRUCT.
> 
> Here's how I have things set up right now.
> month_struct = {month_struct, name: ptr_new( ), day: ptr_new( ), temp_c:
> ptr_new( )}
> station = {station, number:0L, month:{month_struct}}
> po_basin = replicate (station, howmany)
> 
> po_basin.month.name = ptr_new( strarr(2190) )
> ...
> 
> Any ideas?  Since station references a structure with pointers, do I have to
> make a pointer to
> station as well--or something similar?  I can't say I know a lick about
> objects, but this is
> kinda seeming like a problem to be solved by an object?  Oyvey.

Here is what I tried:

IDL> month_struct = {month_struct, name: ptr_new( ), day: ptr_new(), $
       temp_c: Ptr_New()}
IDL> station = {station, number:0L, month:{month_struct}}
IDL> po_basin = replicate (station, 2)
IDL> po_basin.month.name = ptr_new( strarr(2190) )
IDL> *((po_basin)[0].month.name) = 'dad'
IDL> *((po_basin)[1].month.name) = 'mom'

What is the problem!?

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155