comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Pointer and structure question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Pointer and structure question [message #81729] Sat, 13 October 2012 04:20
timmyb89 is currently offline  timmyb89
Messages: 4
Registered: October 2012
Junior Member
I'm having trouble accessing a structure referred to by a pointer. Here's a simplified example of what I want to do.

array=replicate(ptr_new(/ALLOCATE_HEAP),2)
*array[0]={var1:1.0,var2:2.0}

x=*array[0]
print,x.var1
print,*array[0].var1


print,x.var1 works, print,*array[0].var1 gives the error "Expression must be a structure in this context: ARRAY.". I need to be able to access var1 without creating the x variable as seen in this example. What am I doing wrong?

Thanks, Tim
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Empty FOREACH loop
Next Topic: reading netCDF 4.1.1 using IDL version 6.1

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:13:53 PDT 2025

Total time taken to generate the page: 0.00577 seconds