Re: Need interpretation



In article <1h7zx32.1f69sigg5z0d0N%nospam@xxxxxxxxxxxxx>,
nospam@xxxxxxxxxxxxx (Richard Maine) wrote:

> Ron Shepard <ron-shepard@xxxxxxxxxxxxxxxxxx> wrote:
>
> [code elided]
>
> > read(10,cmft,iostat=ierr) i ! this should generate an eof error
>
> Please note that eof is *NOT* an error.

Yes, that is right. My mistake. I guess "error" should be changed
to "condition" in the comment statement. I almost always use the
variable "ierr" for iostat return codes, and that is a little
misleading.

[...]
> I haven't experimented with this in recent years myself, but I've been
> told that most compilers get it right these days. I can't vouch for how
> accurate that is.

At one time, so many compilers got this wrong that I had a library
subroutine that would determine what each compiler did at runtime,
it set a saved variable, and later used that variable to determine
how many backspaces were required in order to append to an existing
file, overwrite the last record, etc.

$.02 -Ron Shepard
.



Relevant Pages

  • Re: reading exact contents of a line
    ... > Apparently there are a few compilers that violate the standard by ... > that more than one EOF value is allowed is that a few compilers happen ...
    (comp.lang.fortran)
  • Re: end-of-record versus end-of-file?
    ... While there might not be a physical endfile record, the standard still ... I used to recall that compilers didn't typically do that, ... do so would be to read until hitting and eof. ...
    (comp.lang.fortran)
  • Re: end-of-record versus end-of-file?
    ... While I swear that I used to recall that compilers didn't typically do that, either my recollection is faulty or things have changed. ... I have been assured that current compilers do simulate the presence of an endfile record, even if there isn't a physical one. ... this comes up when backspacing after hitting and end-of-file. ... According to the standard, if you want to read the last record in a file, one way to do so would be to read until hitting and eof. ...
    (comp.lang.fortran)
  • Re: problem using FILE pointer
    ... feofonly signals that an EOF has been ... Before that the following fread (or getc etc.) statement ... encounter EOF. ... Only for modern compilers. ...
    (comp.arch.embedded)
  • Re: end-of-record versus end-of-file?
    ... While I swear that I used to recall that compilers didn't typically do that, either my recollection is faulty or things have changed. ... According to the standard, if you want to read the last record in a file, one way to do so would be to read until hitting and eof. ... report endfile conditions the same way each time I attempt reading from a file that's positioned there. ... The "real" end of file was the EOT marker. ...
    (comp.lang.fortran)