| Re: associated variables in structures [message #11192] |
Mon, 09 March 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Martin Schultz (mgs@io.harvard.edu) writes:
> I haven't gained any experience with associated variables yet, but my
> approach to this problem would be to figure out the filepos pointer to
> each of the images in a first step and then use this array of "pointers"
> (in fact they are long words) to quickly access the selected image that
> you want to read it in. Now, if David tells me that this is exactly what
> ASSOC is meant for, then I will change my program today!
Oh, oh. I have bad news, Martin. ASSOC is *exactly* a
way to position file pointers in a binary file without you
having to go to all that trouble to keep track of them.
Not only that, but the Associated Variable method is one
of the most efficient in terms of reading and writing
data into and out of files. Many people find it so
useful that they use it even when they *should* be using
something else. :-)
By the way, you can map many *different* associated
variables onto the same file. This great flexibility
is often useful if you have a particular complicated
file structure.
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|