• 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: John Delacour <email@hidden>
  • Date: Thu, 17 Apr 2003 12:07:40 +0100
  • Mac-eudora-version: 6.0a15

At 10:58 am +0100 17/4/03, I wrote:

Here's a reliable way to do the thing, and I'll post a neater way in a follow-up message.



Here's the other way to do things. I think its slower, and you would not want to use it with large files:




set fU to "/tmp/readwrite.txt"
set f to POSIX file fU
set separator_ to ASCII character 10

repeat
try
close access f
on error
exit repeat
end try
end repeat

open for access f with write permission
set eof f to 0
repeat with i from 1 to 1000
set x to (random number from 1000 to 9999)
write "" & x & separator_ to f
end repeat
close access f

set linelist_ to read f using delimiter separator_

set counter_ to 0
repeat with line_ in linelist_
set counter_ to counter_ + 1
if line_ is greater than 8000 then
set s to "Line " & counter_ & ": " & tab & line_
log s
end if
end repeat
_______________________________________________
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: 
 >Read file bug? (From: Timothy Bates <email@hidden>)
 >Re: Read file bug? (From: John Delacour <email@hidden>)

  • Prev by Date: Re: Using tell application "name" where the name comes from GUI Script...
  • Next by Date: Re: Using tell application "name" where the name comes from GUI Script...
  • Previous by thread: Re: Read file bug?
  • Next by thread: Choosing variable names [was - Re: Read file bug?]
  • Index(es):
    • Date
    • Thread