Re: Error: Stack overflow
Re: Error: Stack overflow
- Subject: Re: Error: Stack overflow
- From: John Delacour <email@hidden>
- Date: Wed, 30 Apr 2003 10:41:09 +0100
- Mac-eudora-version: 6.0a16
On 4/29/03 10:12 PM, "Shane Stanley" <email@hidden> wrote:
>> I have used this routine for 15 years.
Use it on a system pre-10.2 with a file that's shorter than your chunk size.
> I think you'll find it falls down rather badly.
You should try things before induging in such nugatory thoughts. It
works perfectly well in 9.2.2. For users of OS 7.1 - 8.6 see below
At 12:08 am -0700 30/4/03, Paul Berkowitz wrote:
Before John ever answered, I supplied an equivalent script that would not
fail on short chunks. It has been ignored here ... Here it is again...
But it's _far_ too long-winded Paul! The routine below will work on
any system since Read Write Commands was born round about Os 7.1.
Apple have appropriated it and hidden it, but update it ??! Perish
the thought!
global f -- for the purposes of this test
(* Create a test file *)
set f to "" & (path to temporary items) & "short.txt"
open for access file f with write permission
write "one word" to file f
close access file f
-------------------------------------
(* Read short file in large chunks *)
set nbytes to 30000
open for access file f
set eof_ to get eof file f
if eof_ is less than nbytes then set nbytes to eof_
repeat
try
set chunk to read file f for nbytes
on error
exit repeat
end try
end repeat
close access file f
chunk -- => "one word"
-------------------------------------
_______________________________________________
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.