N_TAGS( , /LENGTH) strange result! [message #13900] |
Wed, 06 January 1999 00:00  |
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
|
|
|