Re: Getting Fortran to read CTRL/Z in a file as data

After the fortran read has seen the EOF, try to read the next line. If
that also is EOF, you found the real EOF (or the second ^Z in
If the next read gets normal data you can go on reading the file

Yes, this certainly works. The problem is when you hit two or more CTRL/Zs in successive lines. How many EOFs do you take to be definitive?

Tom Wade | EMail: tee dot wade at eurokom dot ie
EuroKom | Tel: +353 (1) 296-9696
A2, Nutgrove Office Park | Fax: +353 (1) 296-9697
Rathfarnham | Disclaimer: This is not a disclaimer
Dublin 14 | Tip: "Friends don't let friends do Unix !"

Relevant Pages

  • Re: Getting Fortran to read CTRL/Z in a file as data
    ... succession). ... INTEGER io-err, sys-err, stat, unit, cond ... After a real EOF, ...
    ... If reading via getline from a command-line file, ... reading input in XML mode is handled by feeding input text ... register int cnt; ... cnt = EOF; ...
  • Re: how to come out of file
    ... You are comparing an int to a pointer and that makes no sense ... actively asign it a new value) and neither will EOF. ... with reading the file will make it return EOF, ...
  • 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. ...
  • Re: c++ string stuff
    ... > I'm reading lines from a file and then reading off a value from the ... > One for the file stream, 2 for the line of text and one for the string ... to have a fairly common misunderstanding about eof. ...