Re: Question about READ statement



On 2008-07-12 12:31:29 -0300, nospam@xxxxxxxxxxxxx (Richard Maine) said:

Gordon Sande <g.sande@xxxxxxxxxxxxxxxx> wrote:

What has not been said is that Fortran's I/O model is record oriented
...
So if you think partial reading and backspacing are important then Fortran
has done it right and if you think byte streams are the future of modern
file systems then Fortran has done it wrong. The opposite assumptions lead
to opposite conclusions.

Of course, all of that was for Fortran 95 and earlier. As of Fortran
2003, Fortran does it both ways; you can choose. See fj's comments about
access='stream', known in some circles as threepwood.

(OK, the threepwood part is an "inside joke"; don't worry if you don't
get it.)

Admitedly, there are no full-language f2003 compilers yet, but there are
quite a few f95 compilers that have implemented this f2003 feature, and
the feature was modelled after compiler-specific functionality that has
been commonly available, but nonstandard and thus varying in exact
syntax, for some time.

Quite right. And as a further correction this applies to unformatted as
backspacing and partial reading of formatted records, when supported, is
based on the record structure that is indicated by the line end character
which is eithe a CR, a LF or even a CR LF pair for byte stream file systems.
Record based file systems do not need this as it is part of the file
system. Another way around this is to insist that all formatted records
be of fixed length with 80 or 132 common choices.

The overall lesson to taken is that the notion of record and the operations
that make sense on records is broader than one gets from from the typical
first course in programming on a Unix clone system. The practical effect
of this is most evident on unformatted records in Fortran.




.



Relevant Pages

  • Re: Why is Fortran not case-sensitive?
    ... I just wanted to know what others think about case sensitivity/consistency in Fortran. ... For example, a variable called "NumberOfAtoms" looks better than "numberofatoms", at least for me. ... There is a notion of case retentive applied to file systems that says ... Case sensitivity may look ...
    (comp.lang.fortran)
  • problem with advfs and a particular IO pattern
    ... Fortran, and my C is not much better) to reproduce the error: ... This problem only happens on local AdvFS file systems. ... and NFS file systems EXCEPT if the NFS file system is exported ...
    (Tru64-UNIX-Managers)
  • Re: fseek
    ... >> may save the ftell value and use it later. ... > streams are constrained to be proper and seek to someplace that was at least ... and a requirement to support arbitrary seeking in text streams ... to give better support to file systems less simple than those ...
    (comp.lang.c)