Re: Portable record length
- From: "Terence" <tbwright@xxxxxxxxx>
- Date: 10 Aug 2006 16:21:05 -0700
Asbjørn L. Johansen wrote:
Is there a portable way of saying "I want to store a 240 byte header +You insist on access by direct unformatted, but the reading program
some data per record" in Fortran 90? The data is in an array of known
length and type.
--
will not know what record data length to use to read these records.
So you HAVE to have a record end marker that you can look for.
Since the data following your header is floating point data, there are
two situations:
1) your floatng point data in is binary words
2) your floating point data is in ascii F or G format
In case 1) your record marker has to be the FIRST character or
characters in your header, because a floating point number as as binary
words can have ANY bit configuration, which will include all possible
end revord markers. So you have to use part of your fixed header as an
identifier.
In case 2) you can write a normal carriage return-linefeed pair afeter
the end of the record (as a word #0D0A, inverted), thus producing an
even number of bytes in the record length. Better if the total length
is a multiple of four.
In both cases the reading porgram opens the file as unformatted binary
(stream, transparent) and looks for the record end maker, and checks
over at a few more records, to find the actual record length, then
closes the file and now opens it in unformatted direct mode to be able
to access any records and even update them.
Terence Wright
Asbjørn L. Johansen
asbjorjo@xxxxxxxxxxxx
.
- Follow-Ups:
- Re: Portable record length
- From: Richard Maine
- Re: Portable record length
- References:
- Portable record length
- From: L. Johansen
- Portable record length
- Prev by Date: Re: How to display .bmp files (created from DISLIN with fortran code) in windows application
- Next by Date: Re: Winteracter grid dialog boxes in MS Developer Studio
- Previous by thread: Re: Portable record length
- Next by thread: Re: Portable record length
- Index(es):
Relevant Pages
|