Re: arrays within structures [message #14931] |
Mon, 12 April 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Waleed (114566.43@CompuServe.COM) writes:
> Is it possible to reduce the size of an array within a structure?
Depends on what kind of a structure it is. If it is an
anonymous structure then something like this is possible:
struct = { a:5, b:Bytarr(100,100)}
struct = {a:struct.a, b:BytArr(50,50)}
But in general it is MUCH better programming practice to
make fields that will change in structures pointers. That
way you don't have to re-define the structure and you can
store whatever you like at the pointer location:
struct = { a:5, b:Ptr_New(BytArr(100,100))}
*struct.b = BytArr(50,50)
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
|
|
|