• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Read file bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Read file bug?
      • From: Timothy Bates <email@hidden>
  • Prev by Date: Mail.app - Checking if an email was sent
  • Next by Date: Parsing a script file
  • Previous by thread: Re: Read file bug?
  • Next by thread: Re: Read file bug?
  • Index(es):
    • Date
    • Thread