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

Home » Public Forums » archive » N_TAGS( , /LENGTH) strange result!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
N_TAGS( , /LENGTH) strange result! [message #13900] Wed, 06 January 1999 00:00
Luis Oliveira is currently offline  Luis Oliveira
Messages: 4
Registered: November 1998
Junior Member
Hi all readers.

My problem with N_TAGS(?,/LENGTH) is that it's result with some structures
is diferent from the size of the files that That structures originate?!
(Diferences of about 3 or 4 bytes.)

I am using IDL to read some unformated data file that was written with a C
program. The size calculated with the C structures was the same as the size
of that structures in files. N_TAGS gives a diferent value, but when I
write the same structure with IDL to a file, it's size is the same as the C
structures!

My IDL version is 5.11 in a windows95 PC.

Thanks for any light on this subject...

Luis

PS: After some tests, I've seen that this happens with structures that have
members that are structures... here goes an example:

IDL> x={a:0L,b:0,c:bytarr(5),d:0B,e:bytarr(3),g:{a:0B,b:0}}
IDL> print,n_tags(x,/length)
20
IDL> x={a:0L,b:0,c:bytarr(5),d:0B,e:bytarr(3),g:{a:0B,b:0},f:0B}
IDL> print,n_tags(x,/length)
24

This two structures only differ by one byte! The real length is 18 and 19.
Now, if I write the structure to a file:

IDL> openw,1,'lixo.txt',/delete
IDL> writeu,1,x
IDL> print,(fstat(1)).size ;To return the size of the file
19
IDL> close,1
Re: N_TAGS( , /LENGTH) strange result! [message #13905 is a reply to message #13900] Tue, 05 January 1999 00:00 Go to previous message
mgs is currently offline  mgs
Messages: 144
Registered: March 1995
Senior Member
In article <01be38eb$bb18fe80$56040a0a@loliveira.ipimar.pt>, "Luis
Oliveira" <eu_luis@hotmail.com> wrote:

> Hi all readers.
>
> My problem with N_TAGS(?,/LENGTH) is that it's result with some structures
> is diferent from the size of the files that That structures originate?!
> (Diferences of about 3 or 4 bytes.)
>
> I am using IDL to read some unformated data file that was written with a C
> program. The size calculated with the C structures was the same as the size
> of that structures in files. N_TAGS gives a diferent value, but when I
> write the same structure with IDL to a file, it's size is the same as the C
> structures!
>
> My IDL version is 5.11 in a windows95 PC.
>
> Thanks for any light on this subject...
>
> Luis
>
> PS: After some tests, I've seen that this happens with structures that have
> members that are structures... here goes an example:

I suspect you're running into problems with the number of bits in the
processing architecture. Sorry, I don't know how to word the explanation
decently. Basically, your 32-bit PC is probably adjusting part of your
structure to sit on byte boundaries. I've seen similar things when dealing
with PC's, Mac's (32-bit systems) and UNIX (32-bit and 64-bit systems).

--
Mike Schienle Interactive Visuals, Inc.
mgs@ivsoftware.com http://www.ivsoftware.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Win32 jacket routines between IDL and third-party DLL
Next Topic: Re: Breaking on Math Warnings?

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

Current Time: Thu Oct 09 20:39:15 PDT 2025

Total time taken to generate the page: 1.03823 seconds