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

Home » Public Forums » archive » Re: Convert a byte array to 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: Convert a byte array to a structure? [message #28877 is a reply to message #28875] Thu, 17 January 2002 15:43 Go to previous messageGo to previous message
Bhautik Joshi is currently offline  Bhautik Joshi
Messages: 21
Registered: November 2001
Junior Member
> Does IDL have a simple and/or elegant way to convert a byte array
> into a structure?
> ..
> But is there a better, platform independent, way?
> (Windows NT/2K, Linux, and Solaris)
I've had no luck with READS and the FORMAT keword either :(

Problem is this:
Lets say we have an arbitrary array of bytes, of length n. We also have
a field, of n bytes length, that needs to be filled with that data as
the concatenation of those values. As an example:

['ff'x,'01'x] -> 'ff01'x -> 65281

BYTE[2] -> intermediate step (?) -> FIX[1]

Would it be possible to do this with other size fields (like converting
4 bytes to a floating point number etc.)? Simply 'gluing' the elements
of they byte array together, like 255*byte[0]+ byte[1] won't work with
floating point numbers (?). I suspect the solution may involve pointers
somehow, but I'm not sure how it might be done.

Then again, I might be missing something blindingly obvious, so please
let me know :)

cheers,
Bhautik

--
/--------------------------------------------------(__)----- ----\
| nbj@imag.wsahs.nsw.gov.au | phone: 0404032617 |..|--\ -moo |
| ICQ #: 2464537 | http://cow.mooh.org | |--| |
|---------------------------+----------------------\OO/|| ------/
| international |
| roast. my sanity has gone |
| its lost forever |
\---------------------------/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: nested subroutines and scope
Next Topic: max, mean, min of array

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

Current Time: Fri Oct 10 04:50:24 PDT 2025

Total time taken to generate the page: 1.12298 seconds