Re: Reading Lines of Text from File Until EOF...
Re: Reading Lines of Text from File Until EOF...
- Subject: Re: Reading Lines of Text from File Until EOF...
- From: Michelle Steiner <email@hidden>
- Date: Tue, 30 Jan 2001 10:09:15 -0800
On 1/30/01 6:39 AM, Robert B. Parker <email@hidden> wrote:
>
I have a text file that I want to read data out of. Each line of the data
>
file has the exact same number of characters in it and I've already got my
>
script to the point where it can parse out the info it needs from each line
>
of text.
>
>
My script is also acquiring each line of text from the file - sort of. The
>
problem I'm having is having the script gracefully close the file and exit
>
when it has hit the End of File (EOF).
I assume that you're using something like this (calculating the numbers
on the fly):
read <file> from startnumber to endnumber
You can have something like this in your script:
set myEOF to get eof of <file>
if endnumber is myEOF then close access <file>
Alternatively, you can read the entire file in one gulp, and do the
parsing in memory, if the file isn't too large for that.
--Michelle
----------------------------------------------------------------------
| Michelle Steiner | Hard as it may be to believe, my |
| email@hidden | life has been based on a true story. |
----------------------------------------------------------------------