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

Home » Public Forums » archive » Re: Calling data from a structure of pointers?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Calling data from a structure of pointers? [message #43020] Fri, 11 March 2005 09:16 Go to previous message
Jonathan Greenberg is currently offline  Jonathan Greenberg
Messages: 91
Registered: November 2002
Member
Hi all -- looks like I had been doing this is a bit wrong -- it did end up
working right -- *structure.pointer[x] was what I needed (I didn't include
the [] it turns out)...

--j


On 3/10/05 10:57 PM, in article d0rfgv$d6v$1@defalla.upc.es, "Antonio
Santiago" <d6522117@est.fib.upc.es> wrote:

> Jonathan Greenberg wrote:
>
>> How do I retrieve the data the pointers are referring to?
>
> pStr is pointer to a structure variable. This strucutre has 2 pointer
> fields.
>
> pStr = PTR_NEW(
> {
> a: PTR_NEW(10),
> b: PTR_NEW(INDGEN(3))
> })
>
>
> pStr - Pointer variable to structure stored in HEAP memory.
> IDL> help, pStr
> PSTR POINTER = <PtrHeapVar6>
>
> *pStr - The content that pStr points to, that is, the structure
> stored in HEAP memory.l
> IDL> help, *pStr, /STRUCT
> ** Structure <1f06f8>, 2 tags, length=8, data length=8, refs=1:
> A POINTER <PtrHeapVar4>
> B POINTER <PtrHeapVar5>
>
> (*pStr).a - First "get" the strucutre and then access to the firts
> pointer field 'a'.
> IDL> help, (*pStr).a
> <Expression> POINTER = <PtrHeapVar4>
>
> (*(*pStr).a) - The same as above but obtain the content that 'a'
> points (10).
> IDL> help, (*(*pStr).a)
> <PtrHeapVar4> INT = 10
>
> And the same for 'b' field:
> IDL> help, (*pStr).b
> <Expression> POINTER = <PtrHeapVar5>
> IDL> help, (*(*pStr).b)
> <PtrHeapVar5> INT = Array[3]
>
>
> IDL> arr = *(*pStr).b
> IDL> print, arr
> 0 1 2
>
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: least square matrix
Next Topic: Editting IDL files under MacOS X

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

Current Time: Fri Oct 10 14:26:28 PDT 2025

Total time taken to generate the page: 1.36224 seconds