PROBLEMS WITH WRITE TO FILE

David Kwinter david at kwinter.ca
Mon May 19 15:31:40 EDT 2003


On 5/19/03 2:12 PM, "Stephen Barncard" <stephenREVOLUTION at barncard.com>
wrote:

> I don't know if it's OSX or a bug in REV, but I'm having a hell of a
> time with the simple WRITE TO FILE command.
> 
> Instead of overwriting the old file, it always appends at leaves
> garbage of the old data at the end of the file,


If your intent is to put 100% new data into a file you MUST first delete the
file:

delete file filePath

open file filePath
write myData to file filePath
close file filePath


However, the problem you encountered is a *feature* for those of us who may
want to write to the file at a specific place, appending new data somewhere,
for example the end of the file using:

open file filePath
write myNewData to file filePath at end
close file filePath




More information about the use-livecode mailing list