|Feb15-13, 06:40 AM||#1|
Reading Universal File Type 58b in Fortran
I am trying to read a universal file (*.unv) in fortran. The file is type 58b (mixed ascii and binary format). I can read the ascii part fine but am having trouble reading the binary part. Does anyone know of anywhere I can access some source code to read this correctly. I suspect its something to do with my open and read statements not being set up correctly but am unsure.
|Feb15-13, 07:15 AM||#2|
I think you need to open the file as a binary file otherwise the IO functions will edit the input stream removing non-ascii characters.
|Feb15-13, 09:14 AM||#3|
Back in the days of Fortran IV when this file format was invented, you could just read the binary data into real or integer variables with A format, and everything worked fine.
The "quiche-eating police" have probably made that illegal in Fortram 90/95 though.
The 58B data format is hightly machine dependent, but at least it includes some flags in the header to tell you which binary format the data is in. If you need to convert from one machine to another (e.g. big endian to little endian, or IBM System/360 floating point to IEEE) that's a different question!
It all else fails, you could write a program in C to convert the type 58b data to type 58 (exactly the same logical data structure, but everything is formatted not binary).
|58b, fortran, unv|
|Similar Threads for: Reading Universal File Type 58b in Fortran|
|[Fortran] problem on reading the csv file||Programming & Comp Sci||6|
|Reading a file in FORTRAN 90 or 95||Programming & Comp Sci||2|
|Fortran 90, problem with reading a file||Programming & Comp Sci||9|
|Help with reading file into FORTRAN||Programming & Comp Sci||0|
|Fortran 90 help reading from file||Programming & Comp Sci||2|