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

Home » Public Forums » archive » Re: Help: C & IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Help: C & IDL [message #14824] Fri, 26 March 1999 00:00
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Tri VU KHAC wrote:
> I want to read a binary file created by a C program. This data is a serie of
> unsigned short numbers (unsigned 2-byte) taking values from 0 to 64000.
> The problem is I don't find out the same type in ILD which enables me to
> read the unsigned 2-byte number.

If you are using IDL 5.2, then unsigned short integers are supported by
the UINT type, e.g.

help, 0U
help, uint(0)
help, uintarr(256,256)

If you are using IDL 5.1 or earlier, first read the data into an INT
(signed short integer) array. Then to extract unsigned short integers,
convert to LONG and perform a bitwise AND with the LONG value 65535
(that is, bits 0-15), e.g.

for i = -5, 5 do help, (long(i) and 65535L)

Cheers,
Liam.

---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help! Color tables - decomposed=0?
Next Topic: Help: C & IDL

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

Current Time: Tue Dec 02 12:17:10 PST 2025

Total time taken to generate the page: 1.28475 seconds