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

Home » Public Forums » archive » structure length in files
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: structure length in files [message #84908 is a reply to message #84907] Tue, 18 June 2013 08:31 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: A possible bug in IDL 8.2.3
Next Topic: Yet Another IDL 8.2.3 Anomoly with Window Refresh

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

Current Time: Wed Oct 08 15:14:52 PDT 2025

Total time taken to generate the page: 0.00413 seconds