Re: Should a freshly opened file automatically be rewound?



<nmm1@xxxxxxxxx> wrote:

In article <itb0l5$koa$1@xxxxxxxxx>,
Phillip Helbig---undress to reply <helbig@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
In article <1k2w8rq.sj34y4slm34cN%nospam@xxxxxxxxxxxxx>,
nospam@xxxxxxxxxxxxx (Richard Maine) writes:

But notice that even for a file that is not already open the standard
does not guarantee that the file will automatically start out rewound
unless you either specify that with the POSITION specifier or rewind the
file yourself after the open.

Right. In Fortran 77, only the latter was possible within the standard.

And what this thread misses is was that even that wasn't! There
are and always have been many files which can be read normally,
but where rewinding them causes chaos. For example, really, but
REALLY, don't do it on a FIFO (including both pipes and sockets)
in any problem that is intended to be either reliable or portable,
let alone both. IBM MVS had lots of such examples, too.

If I recall correctly, the card input deck on CDC machines was a case
where rewinding would have possibly unexpected results. I seem to recall
that you could find yourself reading the control cards, or possibly the
program source code, instead of the part of the deck that was meant to
be the input data.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
.