Reference Guide > B Routines > BYTESWAP Procedure
  

BYTESWAP Procedure
Reverse the byte order for each element of an array.
Usage
BYTESWAP, a
Input Parameters
a—A numerical array or scalar.
Output Parameters
a—On return, the byte order has been reversed in each element of a.
Keywords
None.
Discussion
This routine is useful for transferring data between big-endian and little-endian machines.
 
note
The input parameter is the same as the output parameter, which means that the content of the input variable a is overwritten by the result.
Example
a = DINDGEN(9)
OPENW, 1, 'zzzz'
WRITEU, 1, a
CLOSE, 1
 
; On a machine with opposite endian-ness to the machine 
; used to write 'zzzz':
a = DBLARR(9)
OPENR, 1, 'zzzz'
READU, 1, a
CLOSE, 1
PM, a
BYTESWAP, a
PM, a

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.