- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I need to read a binary file in LINUX IA64 which was written by a fortran compilerin SGI, anybody knows how to reada binary file in linux ia64transferred from SGI? THANKS.
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
6 Respuestas
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
With SGI, there are several possibilities. Their Fortran supports either a C compatible sequential form, or Fortran sequential or direct access. I believe all of the binary file formatsare big-endian,same asother Unix platforms, even though the hardware is not.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
thanks, but I am still confused. eg. I write a real*8 variable in a binary file using fortran in SGI, how can I read it correctly using fortran in linux ia64? thanks.in In SGI,
u=1.2d-5
open(1,FILE=filename,FORM='UNFORAMTTED',ACTION='WRITE')
write(1) u
And then in Linux IA64,
open(1,FILE=filename,FORM='BINARY',ACTIONON='READ')
read(1) u
.but I can not get the value correctly, what is the problem?
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
If SGI machines are indeed big endian (I don't know), then
compile your code on the ia64 box with '-convert big_endian'.
This will tell the compiler to read/write the files as
big_endian instead of the the default little_endian.
Craig
compile your code on the ia64 box with '-convert big_endian'.
This will tell the compiler to read/write the files as
big_endian instead of the the default little_endian.
Craig
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
'BINARY' is a non-standard Fortran format which is more compatible with C. If you want to use that on the Intel side, you should use the equivalent on the SGI side (not standard Fortran unformatted). It may be called 'binary' there too; my memory isn't that good. You still have to reverse the byte order within each data item. There are options in Intel Fortran to open the file as a big-endian file, which should do the job.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I think Craig has the right idea. You can now use CONVERT='BIG_ENDIAN' in OPEN as well. This will properly interpret the record lengths and do the byte swap of integer and real data. The caveat is that you have to list the variables directly in the I/O list - you can't use a record or derived type.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Yes, after I add CONVERT='BIG_ENDIAN', it works. thank you, guys, this is the first time I ask questions in this forum, and I really appreciate your help.

Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla