• 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: Write to file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Write to file


  • Subject: Re: Write to file
  • From: Chris Nebel <email@hidden>
  • Date: Tue, 27 Feb 2001 18:35:29 -0800
  • Organization: Apple Computer, Inc.

email@hidden wrote:

> So then, is there a way to write to a file, beginning from some point, and
> 'deliberately' set the end of the file?
>
> (Mostly) Pseudocode:
>
> set f to open for access file "foo" with write permission
> write "foobar" to f
> write "boz" to f starting at 1
> set eof of f to (seek file position pointer) -- NOT real code
> set c to read f from 1
> close access f
> c
> --> "boz"

You'd do this by setting the end-of-file first, and then writing starting from
there, which will automatically append, like this:

set f to open for access file "foo" with write permission
write "foobar" to f
set eof f to 0 -- f is now effectively empty.
write "boz" to f starting at eof
set c to read f from 1
close access f
c
--> "boz"


--Chris Nebel
AppleScript Engineering


References: 
 >Re: Write to file (From: email@hidden)

  • Prev by Date: Re: Write to file - another question
  • Next by Date: Re: global variable not being recognized by script object subroutine
  • Previous by thread: Re: Write to file
  • Next by thread: Re: Project scope - is it worth doing? (Doug Messick)
  • Index(es):
    • Date
    • Thread