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

Home » Public Forums » archive » Re: XDR- External Data Representation
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: XDR- External Data Representation [message #1202] Tue, 29 June 1993 07:39 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
gnaa38@aero.gla.ac.uk (Paul Porcelli) writes:

> Are there any facilities in Dos to convert a binary file to the XDR binary
> format.
> I am receiving binary data from a PC which i would then like to process on
> a Unix(Sun) Workstation using the IDL software.
> Any advice will be very welcome.

You could do the conversion in IDL on the Sun workstation. The binary
representation of numbers on the PC are the same as on the Sun, except that the
order of the bytes is reversed. You can use the BYTEORDER routine to convert
from PC format to Sun format. For example:

For byte arrays:

No conversion necessary.

For short integer arrays:

BYTEORDER, /SSWAP, array

For long integer, floating point, or complex arrays:

BYTEORDER, /LSWAP, array

For double precision arrays:

TEMP = LONG( array, 0, 2, N_ELEMENTS(array) )
BYTEORDER, TEMP, /LSWAP
TEMP = REVERSE(TEMP, 1)
array(0) = DOUBLE( TEMP, 0, N_ELEMENTS(array) )

That last one is kind of complicated, and is probably not as efficient as the
others, but I don't have any better ideas for how to handle double precision
numbers.

On the other hand, if you had IDL for Microsoft Windows, you could do the
conversion on the PC, either using the /XDR switch on the OPEN statement, or by
using BYTEORDER, /HTOXDR (host-to-XDR) and it's complement BYTEORDER, /XDRTOH.

Bill Thompson

P.S. By the way, the Sun workstation uses the same internal binary
representation as XDR.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: XDR- External Data Representation
Next Topic: Re: Problem w/WIDGET_OLH

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

Current Time: Sun Oct 19 03:47:50 PDT 2025

Total time taken to generate the page: 0.40144 seconds