Re: convert 4 bytes into a long [message #2513] |
Tue, 02 August 1994 11:32 |
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
|
|
|