• 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: Error: Stack overflow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Error: Stack overflow
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: Error: Stack overflow (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Swedish version AS 1.8.3?
  • Next by Date: Re: Error: Stack overflow
  • Previous by thread: Re: Error: Stack overflow
  • Next by thread: Re: Error: Stack overflow
  • Index(es):
    • Date
    • Thread