• 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 14:15:12 -0800
  • Organization: Apple Computer, Inc.

Michelle Steiner wrote:

> On 2/27/01 9:26 AM, Sander Tekelenburg <email@hidden> wrote:
>
> >Be careful. This will just start writing at the beginning of the file without
> >any regard for what the file already contains. If the variable "mydata"
> >happens to contain less data then your file "foo", you'll end up with "foo"
> >containing your new data, followed by some leftovers.
>
> Doesn't write reset EOF automatically?

Only if it makes the file grow. Otherwise, Sander is correct. For example, try
this:

set f to open for access file "foo" with write permission
write "foobar" to f
write "boz" to f starting at 1
set c to read f from 1
close access f
c
--> "bozbar"

File positions with read/write are 1-based, not zero-based, but it considers zero
to be a synonym for 1.


--Chris Nebel
AppleScript Engineering


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

  • Prev by Date: Re: global variable not being recognized by script object subroutine
  • Next by Date: Write to file - another question
  • Previous by thread: Re: Write to file
  • Next by thread: Re: Re: Write to file
  • Index(es):
    • Date
    • Thread