Big-endian to little-endian of direct-access file

Big-endian to little-endian of direct-access file

A coworker has given me a *direct-access* unformatted file generated on a Sun Sparc, so it's big-endian. I want to port their model to x86-64 Linux and to do that I need to generate a little-endian version. I made several attempts to convert it, finally just dumping the contents as text on a Sun to which I had access and reading the result with ifort on Linux. The quantity stored on the file was written by the program that uses it as INTEGER but it reads some (not all, or even most) of the quantities as CHARACTER (a4). (Did I mention that this is a dusty-deck code?) I was tearing my hair out over why the code would not work when I noticed that all the character strings were exactly reversed; i.e. it would get CERP when it should have had PREC.

As far as I can tell the actual numbers in the converted file are correct when they are interpreted by the code as integers. But now I'm concerned about anything it might be reading in as floats.

I wasn't getting F_UFMTENDIAN to work properly for some reason. Would it do the characters right?

1 contenuto / 0 nuovi
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione