uswap man page

uswap — converts the endianness of a Fortran unformatted file

Synopsis

uswap [ -x ] [ -csfde..... ] [ -i infile ] [ -o outfile ]

Description

uswap converts the endianness of a file written with Fortran's unformatted write command. Thus a dump file written on a big endian machine can be converted to be read on a little endian machine. The input and output files may be named, otherwise standard input and standard output are read/written to.

By default the records are assumed to contain data of 4 bytes size, such as the default integer, logical, complex and real types. The size of the records can be set on the command line,

-c
character data
-s
short data (eg: integer*2, logical*2)
-f
float data (eg: integer, real, logical, complex)
-d
double precision data (eg: integer*8, real*8, double precision, double complex).
-e
extended precision data (eg: real*16, extended precision).

The following examples shows how a data file containing a character record, a double precision record, and a number of single precision records can be converted;

uswap -cdf -i infile -o outfile

See uread(1) to read the number of records in a Fortran unformatted data file, and to guess the record contents.

By default uswap will byte swap a file written on the host machine. To byte swap a file written on a foreign machine with opposite endianness, use the -x flag.

Note

The error message

uswap: data larger than file length

often indicates that the file being read has the opposite byte "sex" to the platform uread is being run on. Try using the -x flag to see if this is the case.

See Also

uread(1), ustrip(1)

Author

S.E. Norris s.norris@auckland.ac.nz

Referenced By

uread(1), ustrip(1).