reading unix binary datafile with linux g77

  • Follow


Dear All,
I am looking for a way to read a FORTRAN77 (sequential) binary file
that was written on a unix system in linux environment. Is there a
compiler option (gnu g77 compiler) to make it readable ?
Do you have any other idea to solve this problem ?
Thank you for any comments !
Regards,
Christian
0
Reply ac.winter (1) 6/24/2003 8:25:56 AM

Clive Page <cgp@nospam.le.ac.uk> writes:

> In article <311954ac.0306240025.3c1763b@posting.google.com>,
> Christian <ac.winter@gmx.de> wrote:
> >Dear All,
> >I am looking for a way to read a FORTRAN77 (sequential) binary file
> >that was written on a unix system in linux environment. Is there a
> >compiler option (gnu g77 compiler) to make it readable ?
> 
> You have not given enough information to determine the format,...

Indeed my first thought was to wonder what the question even was.
From all that is said here, it could be asking how to read something
written by the same compiler on the same system, which requires
nothing special needed at all.  G77 is after all an f77 compiler that
runs on unix systems (among others) and thus could well fit the
description of how the data was written.  I assume this isn't
really the question  - doesn't seem likely.

Are you trying to read this on something that is not a Unix system?
You didn't actually say that I could find.  Oh hold it...perhaps
you did.  Since Linux is a Unix, I read "on a unix system in a
liunux environment" as a single description.  On rereading more
carefully, I suspect you intended the "unix system" and
"linux environment" parts to describe different systems.  That
helps some, but doesn't actually tell all the important things
though.

Much more relevant are the *PARTICULAR* systems, in particular the
hardware.  There are many Unixes running on many kinds of hardware.
Even once you restrict it to Linux, that can cover a lot of hardware
differences that matter - Sparc?  Alpha, IBM mainframe?  All of those
are possibilities and all have important differences.  I suppose you
probably mean on an Intel 32-bit Linux because otherwise you'd
probably have said...but I've made that kind of assumption and been
wrong before and given wrong answers as a result.

The particular compiler it came from can matter also, although there
is at least a lot of commonality on that among unix compilers for
the same hardware.

-- 
Richard Maine                       |  Good judgment comes from experience;
email: my first.last at org.domain  |  experience comes from bad judgment.
org: nasa, domain: gov              |        -- Mark Twain
0
Reply nospam47 (9742) 6/24/2003 3:34:12 PM


"Christian" <ac.winter@gmx.de> wrote in message
news:311954ac.0306240025.3c1763b@posting.google.com...
> Dear All,
> I am looking for a way to read a FORTRAN77 (sequential) binary file
> that was written on a unix system in linux environment. Is there a
> compiler option (gnu g77 compiler) to make it readable ?
> Do you have any other idea to solve this problem ?
> Thank you for any comments !
> Regards,
> Christian


Here are examples

Real*8 B(64)     to define the record

OPEN(4,FILE='REALDT',FORM='UNFORMATTED',RECL=256,ACCESS='DIRECT')
OPEN(4,FILE='REALDT',FORM='UNFORMATTED',RECL=264)

C for direct access

Read(4,rec=N) B

C for sequential file

Read(4) B

Be careful with the record length each record is read once and if there is
extra information it will be skipped



Arto Huttunen


0
Reply ArtoHuttunen (5) 6/24/2003 7:30:08 PM

>"Christian" <ac.winter@gmx.de> wrote in message
>news:311954ac.0306240025.3c1763b@posting.google.com...
>> I am looking for a way to read a FORTRAN77 (sequential) binary file
>> that was written on a unix system in linux environment. Is there a

In article <bda8rm$p6d$1@phys-news1.kolumbus.fi>,
Arto Huttunen <ArtoHuttunen@kolumbus.fi> wrote:
>
>Here are examples
>
>Real*8 B(64)     to define the record

That is invalid in all Fortran Standards (hint: look at DOUBLE PRECISION)
>
>OPEN(4,FILE='REALDT',FORM='UNFORMATTED',RECL=256,ACCESS='DIRECT')
>OPEN(4,FILE='REALDT',FORM='UNFORMATTED',RECL=264)

You may find it hard to open the same file in two ways concurrently.
Anyway, the original poster clearly said he wanted to read a SEQUENTIAL 
binary file.

>
>C for direct access

You cannot use C for a comment in free-format source-code, which your
examples clearly use as there is no 6-column left-hand margin.

As previous posters have pointed out, the original problem did not give
enough information, but if he was, say, trying to read on an Intel/Linux
system a file written on Sparc/Solaris, then byte ordering will be one of
the several problems to be solved.  I am sure you are trying to help, but
actually nothing you have posted helps with the principal problems at all.

-- 
Clive Page   cgp <at sign> le.ac.uk
0
Reply cgp (24) 6/25/2003 9:48:20 AM

3 Replies
182 Views

(page loaded in 0.785 seconds)

Similiar Articles:













7/24/2012 9:37:33 PM


Reply: