Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29233 Discussions

Trying to write 8bit data as big_endian but -convert big_endian doesn't seem to work

joanne_crawford
Beginner
618 Views
When i compile my code with -c -u -O -auto -convert big_endian -assume byterecl -align none and use the open statement OPEN(unit=23, file=testfile, status="replace", action="write", access="sequential", form="unformatted") to write out 16bit data, this writes out a data file that is big_endian. When i use the same compile options and the open statement OPEN(unit=23, FILE=Filename, FORM='UNFORMATTED', ACTION='WRITE', STATUS='UNKNOWN', RECL=RecordLength, ACCESS='DIRECT') to write an 8 bit data array as big_endian it doesn't work. The file is as it should be except that it is little_endian. Doesn't anyone have any similar experience of this?

Thanks,

Jo




0 Kudos
3 Replies
Steven_L_Intel1
Employee
618 Views
Jo,

What are you expecting to happen with 8-bit data? Big-endian does byte swapping of a multi-byte value, but a single byte value has nothing to swap with.
0 Kudos
joanne_crawford
Beginner
618 Views
Hi,

Sorry i got confused with this. I thought that was the case with 8bit data but then the man pages for ifort says that -convert big_endian swaps INTEGER*1 so i thought maybe my understanding was wrong. I think i have now found the problem else where. Sorry to waste your time!

Thanks,

Jo
0 Kudos
Steven_L_Intel1
Employee
618 Views
I'll check the man page to see if it needs correction. The Building Applications manual says " INTEGER(KIND=1) data is the same for little endian and big endian."
0 Kudos
Reply