uswap [ -x ] [ -csfde..... ] [ -i infile ] [ -o outfile ]
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,
short data (eg: integer*2, logical*2)
float data (eg: integer, real, logical, complex)
double precision data (eg: integer*8, real*8, double precision, double complex).
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.
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.
S.E. Norris firstname.lastname@example.org