Re: Read file bug?
Re: Read file bug?
- Subject: Re: Read file bug?
- From: julifos <email@hidden>
- Date: Thu, 17 Apr 2003 09:53:17 +0200
>
Hi there,
>
If I open a file and read until the end of a line, I expect to eventually
>
error as we hit the eof.
Here it throws a "End of file error." (AS 1.9.1, OS 10.2.5)
>
This code, however, loops forever. Bug or misunderstanding. How does one
>
know that the last line has been read?
>
(the "posit" bit won't compile if you are not using smile. I use it as a
>
textual progress indicator)
>
>
property pPathToDataFile : "path:to:a:text:file"
>
set f to open for access file pPathToDataFile
>
set targetString to "not in this file"
>
set n to 1
>
set nextN to 1
>
repeat
>
set a to read f until ASCII character 10
>
if n > nextN then
>
postit n & "" & a as string
>
set nextN to n + 50
>
end if
>
set n to n + 1
>
end repeat
>
>
close access file pPathToDataFile
JJ
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.