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

Home » Public Forums » archive » Re: BYTES to 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: BYTES to LONG [message #22339 is a reply to message #22334] Tue, 07 November 2000 00:00 Go to previous messageGo to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Kelly Dean wrote:
>
> I am reading in a combination ASCII/BINARY file with USGS DLG
> information as a binary file.
>
> I am able to convert the bytes into ASCII with STRING([72B, 101B, 108B,
> 108B, 111B]).
>
> However, I cannot figure out how to convert the 4 bytes into LONG, whihc
> is the UTM X and Y numbers. Any suggestions?
>
> Kelly

If I understand your question correctly,

if

x = [ 0B, 1B, 1B, 1B ]

then long_x = TOTAL( ISHFT( LONG(x), [24,16,8,0] ) )

??

This gave me long_x = 65793.0 = 65536 + 256 + 1 which seems correct, no?

For some reason the TOTAL returned a floating point number? Weird. Never noticed that
before.

Hmm.

You could also just add the requisite power of two to each individual element before
totaling also. Dunno if either works with a sign bit.

paulv

--
Paul van Delst Ph: (301) 763-8000 x7274
CIMSS @ NOAA/NCEP Fax: (301) 763-8545
Rm.207, 5200 Auth Rd. Email: pvandelst@ncep.noaa.gov
Camp Springs MD 20746
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Electrical Engineer/Controls Specialist Wanted
Next Topic: Re: UTM conversion

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

Current Time: Fri Oct 10 22:50:59 PDT 2025

Total time taken to generate the page: 1.44073 seconds