Re: Re: Write to file
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?