| Steve O'Hara-Smith 2006-10-30, 7:15 pm |
| On Fri, 27 Oct 2006 00:53:05 -0700
glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote:
> Rostyslaw J. Lewyckyj wrote:
>
> (snip)
>
>
> That is also the PASCAL way, I don't know which came first.
>
> The C way is that you test for EOF only after you have tried to
> read past the end of file, more like the Fortran way.
>
> Since most OS that I know of don't give an end of file indication
> until you actually try to read more, the PASCAL way would seem to
> require a complicated buffering system, reading one record ahead.
Not really, all that is required is an EOF flag that gets set on
open (usually to false but to true if the file is empty) and then gets set
after every read if that read has pushed the file pointer to the end.
--
C:>WIN | Directable Mirror Arrays
The computer obeys and wins. | A better way to focus the sun
You lose and Bill collects. | licences available see
| http://www.sohara.org/
|