Re: Error: Stack overflow
Re: Error: Stack overflow
- Subject: Re: Error: Stack overflow
- From: "G?ran Ehn" <email@hidden>
- Date: Tue, 29 Apr 2003 16:26:35 +0200
OK, I see, I had some similair idea of splitting the file
in my head, but I thought that it must be possible to read
the whole file at once. But I guess its not possible,
right? Is this due to limitations the script editor
itself?
/goran
On Tue, 29 Apr 2003 06:53:03 -0700
Paul Berkowitz <email@hidden> wrote:
On 4/29/03 6:38 AM, "G?ran Ehn" <email@hidden>
wrote:
I'm reading a file from disk which is about 1200 lines
(52k) which is not very large in my mind. However I get
this error telling me "stack overflow" when reading
large
files, smaller files are reads ok though. Is there a way
to control memory in AS or is it just a lack in the
script
editor (1.8.3 under OS 9.2.2)? Any workarounds for this
kind of problem?
read my_xmlfile as string to eof --reads the file
set fileRef to open for access alias "file:path"
try
set r to read fileRefon error
on error
set r to my ReadPartials(fileRef)
end try
on ReadPartials(fileRef)
local b, y, r, textClump
set b to 1
set y to 30000
set r to ""
set finished to false
repeat until finished
try
set textClump to read fileRef from b to y
set r to r & textClump
on error -- last text clump
set textClump to read fileRef from b to eof
set r to r & textClump
set finished to true
end try
set {b, y} to {b + 30000, y + 30000}
end repeat
return r
end ReadPartials
--
Paul Berkowitz
_______________________________________________
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.
_______________________________________________
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.