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 #8115] Fri, 07 February 1997 00:00 Go to previous message
Peter Berdeklis is currently offline  Peter Berdeklis
Messages: 3
Registered: February 1997
Junior Member
On Fri, 7 Feb 1997, David Fanning wrote:
> 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?
>
> 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


Thank you for your response.

Unfortunately, I'm not reading 16-bit integers but 32-bit integers.
Sorry I forgot to mention that - too much time spent programming with
DJGPP (GNU C for DOS). So how would I pull the same trick with 32-bit
integers?


> 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.

In fact, it should be part of the IDL manuals. :)

Sorry for asking a question 2ce. I'm not a regular participant to the
newsgroup, just a desperate newbie.

By the way David, I just looked up your Web page. Thanks for the tips.
Since you worked at RSI, do you know why IDL doesn't have an unsigned data
type?

---------------
Peter Berdeklis
Dept. of Physics, Univ. of Toronto
[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: Wed Oct 08 18:36:03 PDT 2025

Total time taken to generate the page: 0.00937 seconds