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

Home » Public Forums » archive » Re: Array of associated variables?
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: Array of associated variables? [message #42280 is a reply to message #42273] Thu, 20 January 2005 06:52 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sso@nilu.no writes:

> However, I dont get this really to work. It's probably a basic error I
> am doing, but a code like this will crash.
>
> all = ptrarr(n, /allocate_heap)
>
> FOR i = 0, n-1 DO BEGIN
> ;..define a, the associated variable (that works)
> p = ptr_new(a)
> all(i) = p
> ENDFOR
>
> ;..extract values back:
> a = all(0)
> pval = *a
>
> ----------
> I'm not that into pointers so it may be a simple error

Don't know. Looks right to me. Here is my example:

n=3
filename = 'junk'
all = ptrarr(n)

FOR I = 0, n-1 DO BEGIN
Openw, lun, filename + String(I, format='(i1)') +'.pro', /Get_Lun
a = Assoc(lun, Bytarr(200))
p = ptr_new(a)
all[I] = p
ENDFOR

;..extract values back:
a = all[0]
pval = *a
help, pval
END

And here is what I get:

IDL> .COMPILE "C:\RSI\David\assoc_ptr.pro"
% Compiled module: $MAIN$.
IDL> .go
PVAL BYTE = File<C:\RSI\David\junk0.pro> Array[200]


Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: AVI, MPEG, QT reading, writing and preprocessing
Next Topic: Tracking Cursor in Object Graphics Draw Widgets

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

Current Time: Thu Oct 09 02:49:51 PDT 2025

Total time taken to generate the page: 0.37668 seconds