Overwrite export file
I have a screen scraper script setup to write to a text file after each patter application. Is it possible to modify the output script to overwrite the file each time vs. appending to it. I run it everyday and need it to overwrite the same text file so it will not append to it.
If you happen to be using the
If you happen to be using the FileWriter class it takes an additional parameter to tell it to append to the file. If you omit that parameter (or try setting it to false) then it should overwrite the file rather than append to it.
old:
out = new FileWriter( outputFile, true );
new:
out = new FileWriter( outputFile, true );
If you wanted to be extra thorough, you could first delete the file before you ever attempt to write to it.
-Scott
I looked for the delete
I looked for the delete command in the link you sent, but could never find it.
Sorry, delete is part of
Sorry, delete is part of Java's File class.
http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html