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

Re: Re: Write to file


  • Subject: Re: Re: Write to file
  • From: email@hidden
  • Date: Tue, 27 Feb 2001 13:39:36 EST

>On 2/27/01 3:56 AM, Rick Plummer <email@hidden> wrote:
>
>>I need to write data to a file to read back prefs. How can I overwrite the
>>entire file each time?

and Michelle Steiner <email@hidden> responded

>write mydata starting at 0 to file "foo"

No, that will cause problems if the new information is shorter than the old
information, as demonstrated here:

try
set transID to open for access file "HD:test" with write permission
write "Something very long and wordy." to transID starting at 0
delay 2 -- avoid subtle timing issues
write "Something short." to transID starting at 0
close access transID
on error errmsg
close access transID
display dialog errmsg
end try

Instead, use this

set eof transID to 0

which will erase the entire file >*poof*<

Jeff Baumann
email@hidden
www.linkedresources.com

14 Days, 11 Hours, 15 Minutes
How is it going to end?


  • Prev by Date: Replacing range within a string
  • Next by Date: Re: Replacing range within a string
  • Previous by thread: Re: Write to file
  • Next by thread: Re: Write to file
  • Index(es):
    • Date
    • Thread