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

Home » Public Forums » archive » Union in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Union in IDL? [message #16259] Mon, 12 July 1999 00:00
Guido Lemoine is currently offline  Guido Lemoine
Messages: 3
Registered: October 1998
Junior Member
Dear All,

Is there a way to convert a bytarr of length N_TYPE to TYPE?

For instance, if TYPE = DOUBLE (so, N_TYPE=8), how do I convert the
bytarr(8) to
DOUBLE. I am looking for something like the UNION construction in C
(i.e. which
allows you, more or less, to reference a piece of memory as more then
one type).

I have been looking at IDL pointers, but can't seem to get that working.
A (fairly stupid)
work-around is to write the bytarr(8) to a binary file (writeu) and then
read it again
into a double. But that's not very elegant. Also, I would think it is
somewhat bothersome
to write an external C extension to do the union.

Ideally, there would be something like read_bin, BYTARR_VAR, VAR, /TYPE

Any ideas?

Guido Lemoine.

PS. The reason why this is non-trivial is that I am implementing a
vector reader with
DataMiner. I am already able to dump ArcView shape files into the data
base. The vectors
are written as binary blocks of doubles. If I read the stuff, however,
using VectorTable->GetField(n)
I defaultly get a BYTARR with a length equal to the number of doubles*8.
I need to convert
these back to doubles (but double(BYTARR) doesn't work, of course...).
[Message index]
 
Read Message
Previous Topic: Re: 3D Graphics Question
Next Topic: Re: Creating Directories

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

Current Time: Wed Oct 08 19:58:10 PDT 2025

Total time taken to generate the page: 0.00409 seconds