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

Home » Public Forums » archive » Re: reading unformatted data into a structure
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: reading unformatted data into a structure [message #29726 is a reply to message #29723] Tue, 19 March 2002 09:54 Go to previous messageGo to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
>
> unsigned short coordSys; /* The coordinate system used:
> 0 = Geographical lat/long.
> 1 = Projection */
> char projection[32]; /* Projection name (see above) */
> int projParam1; /* 1. projection parameter (see above). */
>
> this int may well need to be aligned on a word boundary. If so 16 bits of
> padding will have been inserted into the struct by the C compiler to align
> it. If the struct is output by a single write this padding will have been
> output with the rest of the data.
>
> On the PC, IDL may have been built to allow structs without padding, so
the
> same aligment problem might not appear in IDL, so reading the struct as a
> single item in IDL will store those 16 bits of padding into projParam1,
and
> all other items in the struct will be similarly offset.
>

This seems to be the problem. I was wondering why I had 2 null bytes at the
beginning of my next bytarr. I had actually stumbled on the data by padding
the entire header but this meant that most of my header data was wacked.

> If the struct was part of an array, then a further 16 bits of padding may
> have been added at the end of the struct to ensure that the int which is
> the first element of the second struct in the array was properly aligned.
>

The struct was not part of an array because I think that I am reading the
correct data.

Thanks!

-Rick
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Image editing with IDL?
Next Topic: days of the week

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

Current Time: Sat Oct 11 15:51:33 PDT 2025

Total time taken to generate the page: 1.12047 seconds