• 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: Timothy Bates <email@hidden>
  • Date: Mon, 21 Apr 2003 22:15:18 +1000

>> 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)

Turns out it is a bug to do with unix line endings. I have filed a radar
report with a text file that fails to generate the EOF error that I was
wanting.

>> 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
_______________________________________________
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.

References: 
 >Re: Read file bug? (From: julifos <email@hidden>)

  • Prev by Date: Path to current script file?
  • Next by Date: Re: Read file bug?
  • Previous by thread: Re: Read file bug?
  • Next by thread: Timesaving Solution
  • Index(es):
    • Date
    • Thread