[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hexadecimal variables
- Subject: Re: hexadecimal variables
- From: Dick Jackson <djackson(at)dfanning.com>
- Date: Thu, 22 Apr 1999 15:24:33 GMT
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <371E4B0B.D4F49F34@cmdl.noaa.gov>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:14463
Hi,
Pavel Romashkin wrote:
>
> Hi,
> Is there a nice way to convert hexadecimal variables? Here's what I am
> trying to do:
>
> This is received from the outside.
> h_string = '40000FC0DA'
>
> [...] Can anyone suggest a neater way
> to do this? Maybe, there is a way to use Z-formatted READ here?
You've got it, using ReadS (read from string). It looks like you have five
bytes so you need a very long integer to store this, giving me the first
chance I've had to use IDL 5.2's new data types:
IDL> h_string = '40000FC0DA'
IDL> long64=0LL
IDL> ReadS, h_string, long64, Format='(Z0)'
IDL> help, long64
LONG64 LONG64 = 274878939354
Hope this works OK for you.
Cheers,
--
-Dick
Dick Jackson Fanning Software Consulting, Canadian Office
djackson@dfanning.com Calgary, Alberta Voice/Fax: (403) 242-7398
Coyote's Guide to IDL Programming: http://www.dfanning.com/