Re: "End of file error"
Re: "End of file error"
- Subject: Re: "End of file error"
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 29 Dec 2000 12:14:21 -0800
On 12/29/00 12:01 PM, "ScaryFish" <email@hidden> wrote:
>
My script needs to be able to read from and write to a simple text file. I
>
open the file for access and read the contents using:
>
>
open for access file "Hosts" of folder "Preferences" of folder "System
>
Folder" of startup disk
>
copy the result to thehostsfile
>
read thehostsfile
>
>
The wierd bit is once the script runs once ( My script also writes to the
>
file and sets the eof the file) and try to run again I get "Finder got an
>
error:End of file error".
>
>
The wierd bit is if I open the text file in simpletext, type a space, delete
>
the space and save it, then the script will run fine again. Once. If I
>
save the script as an application, it never works. Always gets "End of file
>
error"
>
>
Does setting the eof file somehow corrupt it to being opened by the script
>
again?
>
You haven't opened the thehostfile for access with write permission - or
have you? Please include all pertinent bits of code, or it's not possible to
help you. Are you trying to overwrite the thehostfile, or add on to the end?
I assume the latter, or there would be no point to reading the same bit
again, would there? Unless you're just testing. Which is it? And you haven't
closed the thehostfile for access. It can't read the new bit until you close
it and open it again. And there's no need to do this in the Finder either -
you're just asking for problems that way.
Could you send a bit more of your script, with an indication of what you're
trying to do?
--
Paul Berkowitz