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

Home » Public Forums » archive » Re: convert 4 bytes into a long
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 4 bytes into a long [message #2513] Tue, 02 August 1994 11:32
Geoff.Sobering is currently offline  Geoff.Sobering
Messages: 14
Registered: June 1994
Junior Member
In article <318jd6INN5h2@i32.sma.ch>, stl@sma.ch (Stephen Strebel) wrote:
> I am trying to find out if I can convert 4 byte value into 1 long value.
> For example
> b = byte(4)

if you have a 4 byte array 'b', you can convert it into a long (or most any
other 4-byte data type) with:

l = long( b, 0, 1 )

the second parameter is the offset in the source array to start converting,
and the third parameter is the number of elements in the first dimension of
the resulting array. These parameters work with most of the IDL
type-conversion functions.

P.S. The reverse is also true, you can convert the long varaible 'l' into a
byte array with:

b = byte( l, 0, 4 )

--
Geoff Sobering (Geoff.Sobering@nih.gov)
In Vivo NMR Research Center
National Institutes of Health
[Message index]
 
Read Message
Previous Topic: Re: array addressing
Next Topic: Probs w/ keyword_set

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

Current Time: Fri Oct 10 14:30:03 PDT 2025

Total time taken to generate the page: 3.60409 seconds