Helder writes:
> [Short summary: When IDL writes structures in unformatted binary data files, what size will the resulting file have, that described by n_tags(Example1,/LENGTH) or n_tags(Example1,/DATA_LENGTH)?]
>
> I was just looking at the length/size of a structure. I'm reading data from a file and using structures looking like this:
>
> Example1 = {Field1: 0 ,$ ; Integer, 2 byte
> Field2: 0 ,$ ; Integer, 2 byte
> Field3: 0 ,$ ; Integer, 2 byte
> Field4: 0 ,$ ; Integer, 2 byte
> Field5: 0ULL } ; Unsigned Long64, 8 byte
>
> Example2 = {Field1: 0 ,$ ; Integer, 2 byte
> Field2: 0 ,$ ; Integer, 2 byte
> Field3: 0 ,$ ; Integer, 2 byte
> Field4: 0 ,$ ; Integer, 2 byte
> Field5: 0ULL ,$ ; Unsigned Long64, 8 byte
> Field6: 0 } ; Integer, 2 byte
>
> When I look at it using the help command with /structure, I get:
> IDL> help, example1, example2, /struct
>
> ** Structure <edbf6a0>, 5 tags, length=16, data length=16, refs=1:
> ...
> ** Structure <104d4de0>, 6 tags, length=24, data length=18, refs=1:
> ...
>
> What is bothering me is that the addition of a field in the second structure results in an increased length (24 bytes) for a data length of 18 bytes. In the first example, the length is the same as the "data length". [the origin of this is probably filling the structure up to multiples of 8 bytes...]
> The same results can be obtained using n_tags with the /length and data_length keywords.
>
> So, reading the n_tags documentation, it seems like the Data_length is constant (machine independent) and the length is machine dependent (as in 32-64 bit and other things).
>
> However, my question:
> I noticed that when I read structures, the sizes are the expected "data_length" (machine independent). When IDL writes, what size will I have to expect: "length" or "data_length"?
Donno. Why don't you write one and find out? You can check the file size
with FSTAT.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|