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

Home » Public Forums » archive » Please help me avoid loops and conditionals
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: Please help me avoid loops and conditionals [message #36410 is a reply to message #36332] Wed, 10 September 2003 10:06 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Patrick Ford writes:

> The second is related to the same program. I want to take a string of
> 4 contiguous bytes and convert them into a long unsigned or signed
> integer. I remember doing this in Fortran, Pascal and C with some
> variations on a theme of having variables of type byte and long point
> to the same memory location. Is there some clever way of doing the
> same in IDL? My current klugy method is based on the following:
>
> R = ary(p) + (16 * ary(p+1)) + (16^2 * ary(p+2)) + (16^3 * ary(p+3))
>
> Where ary is a byte array.

This is what the LONG and ULONG functions are used for.
The first positional parameter is the byte array you want
to read from and the second positional parameter is
the offset into the array.

number = Long(ary, 16) ; skip first 16 bytes, read next four.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Work with ENVI vector layers
Next Topic: Re: What does an optimal scientific programming language/environmentneed?

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

Current Time: Wed Dec 03 14:07:06 PST 2025

Total time taken to generate the page: 2.24243 seconds