Hello Lists,

A recent thread on Lingo-l set me to thinking about overwriting files using FileIO 
Xtra (particularly files that are longer than the string to be written).  The standard 
solution seems to have been to delete the file before writing it again, but this seems 
scary if one doesn't have a backup system
built.  While walking my dogs this morning, it struck me that if the string to be 
written were shorter than the existing file, one could simply append the EOF character 
to that string before writing it.

My newly modified FileIO Xtra wrapper class implementing this technique is available 
from the below URL.  It must be saved first to a local hard drive, since the text file 
will be created using "the moviePath".  It also requires BuddyAPI.

Once saved, entering "test()" into the message window will print "hello world 
gooodbye" followed by "hello world" if the test is successful.  These are the results 
of successive writeFile()/readFile() commands and indicate that a longer file has been 
successfully replaced by a shorter file.

http://www.bluejade.com/public_resources/director/fileioxtra.html

Thank you for any feedback.  I hope some of you find the wrapper useful in your own 
work (please send me an e-mail if you do).

Regards,

Daniel

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to