Re: Need interpretation
- From: "Gary L. Scott" <garyscott@xxxxxxx>
- Date: Fri, 23 Dec 2005 10:12:34 -0600
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.
Well, it COULD be if there is not supposed to be an EOF at that file position...:-)
I think "2" should be the output on the last line, but some compilers don't handle the implicit endfile correctly and they print out "1" instead. My version of gfortran happens to print out "0", which is just an outright error I think.
Is it correct that the standard does define what the above program should write in that last write statement?
Yes. And yes, it should be a 2. The first backspace backspaces over the (possibly virtual) endfile record. The second backspaces over the "2" record.
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.
--
Gary Scott mailto:garyscott@xxxxxxx
Fortran Library: http://www.fortranlib.com
Support the Original G95 Project: http://www.g95.org -OR- Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html
Why are there two? God only knows.
If you want to do the impossible, don't hire an expert because he knows it can't be done.
-- Henry Ford .
- References:
- Need interpretation
- From: Jerry DeLisle
- Re: Need interpretation
- From: Ron Shepard
- Re: Need interpretation
- From: Richard Maine
- Need interpretation
- Prev by Date: Re: Need interpretation
- Next by Date: Is there interest in an embedded database engine for F95?
- Previous by thread: Re: Need interpretation
- Next by thread: Re: Need interpretation
- Index(es):
Relevant Pages
|