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

Home » Public Forums » archive » Re: Unsigned Integers - How?
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: Unsigned Integers - How? [message #8125 is a reply to message #8115] Fri, 07 February 1997 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Peter Berdeklis <peter@atmosp.physics.utoronto.ca> writes:

> I'm trying to read a binary data file into IDL. Included in the data
> headers are several unsigned integers for dates and times. Some of the
> unsinged integers are overflowing, giving me negative integers. How do I
> specify a variable as an unsinged integer in IDL?

It's deja vu all over again, as one of our famous baseball players once
said. :-)

Read the unsinged integers into *signed* 16-bit integers in IDL.
(You are already doing this, apparently).

date = 0L
time = 0L
READU, lun, datafile, date, time

Convert them to the correct *unsigned* values, like this:

date = LONG(date) AND 'FFFF'x
time = LONG(time) AND 'FFFF'x

Seeing the same question twice in the same week means it
has to be tip material! I've put this answer on my web page
for future reference.

Cheers!

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: UNsigned Integer Data
Next Topic: Re: IDL 5.0 news at RSI website *correction*

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

Current Time: Fri Oct 10 08:35:57 PDT 2025

Total time taken to generate the page: 0.95922 seconds