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

Can ifort handle unformatted files that are both big_endian and little_endian

crtierney42
New Contributor I
1,048 Views

I have received some data files that have been difficult to read. It turns out that the data in the file are little endian, but the Fortran record indicators are big_endian. I can't go back to the source and figure out what they were doing. I am pretty sure the files were generated on an IBM Power system under AIX (but I am not positive).

Is there a way to tell the compiler to read the record indicators as one endian type, but the data as another?

Thanks,
Craig

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,048 Views
No, sorry. I'd be very curious to know the details of how such a file was constructed - I haven't run into such a combination before.

The best I can suggest is to write some routines to do the byte swapping after you read the data.
0 Kudos
crtierney42
New Contributor I
1,048 Views
It came from an IBM Power system. I think that the data were generated by a C routine that mimicked creation of an unformatted fortran file. I found someone who wrote a code to do the conversion for this data.


0 Kudos
Reply