• 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: Paul Berkowitz <email@hidden>
  • Date: Tue, 29 Apr 2003 06:53:03 -0700

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.

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

  • Prev by Date: Re: iTunes 4 & Artwork scripting... Ahhh?
  • Next by Date: Re: Language at a Glance
  • Previous by thread: Error: Stack overflow
  • Next by thread: Re: Error: Stack overflow
  • Index(es):
    • Date
    • Thread