Re: Read File Problems
Re: Read File Problems
- Subject: Re: Read File Problems
- From: Shane Stanley <email@hidden>
- Date: Tue, 20 Mar 2001 20:54:33 +1100
On 20/3/01 8:37 PM +1000, Nigel Garvey, email@hidden, wrote:
>
My own investigation into this sort of thing last year suggests that a
>
"simple read" - like a read by file specification after opening for
>
access - first checks whether there's an open-file reference for that
>
file. If there is, it uses it; if not, it opens the file itself. The
>
reference for a freshly opened file has its file pointer set for the
>
beginning of the file, but a reference that has already been read or
>
written to will have the pointer set somewhere else. This means that if
>
the file is already open - either because it's in use or because some
>
previous error has prevented it from closing - a simple read has a good
>
chance of not getting the expected results. You can get round this using
>
the 'from' and 'to' parameters, but then you screw up the file pointer
>
for whatever process opened the file in the first place - which may not
>
be the current script.
Makes sense, thanks.
--
Shane Stanley, email@hidden