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

Home » Public Forums » archive » Re: confusion around a pointer to an array of structures
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: confusion around a pointer to an array of structures [message #45146 is a reply to message #45000] Tue, 09 August 2005 13:07 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Edd wrote:
> Henry <henrygroe@yahoo.com> wrote:
>
>> But, I can see no other way around this, aside from redesigning how I'm
>> storing the information. Does anyone see how to do the equivalent of
>> "((*a)[0]).x = 99d" in the above example? (without the awkward three
>> line dumb hack I've shown)
>> I'm sure I'm just not seeing something simple....
>
>
> Is there anything incorrect about saying (*a)[0].x=99d ?
>

I tried the OP's method and got his error,

IDL> ((*a)[0]).x = 99d
% Attempt to store into an expression: Structure reference.
% Execution halted at: $MAIN$

and thought that the "correct" syntax would be something like ((*a).x)[0]

This is what I get,

IDL> a = ptr_new( replicate( {x:0d}, 5 ) )
IDL> (*a).x = dindgen(5)
IDL> help, ((*a).x)[0]
<Expression> DOUBLE = 0.0000000
IDL> ((*a).x)[0] = 99d
% Internal error: The Interpreter stack is not empty on exit.
IDL> help, ((*a).x)[0]
<Expression> DOUBLE = 99.000000

So that works too..... sort of.

Veird.

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: On Unix IDL CD must mount with exec for install to work
Next Topic: confusion around a pointer to an array of structures

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

Current Time: Sat Oct 11 08:59:20 PDT 2025

Total time taken to generate the page: 1.19871 seconds