// Opens a file for writing and returns a Java FileWriter object which // can be used to write to the file. You may also wish to wrap the // FileWriter in a BufferedWriter, or open a different kind of writer, // like a PrintWriter, etc. openForWrite[path, append=false] := { writer = newJava["java.io.FileWriter", [path, append]] return writer } // Sample use of the writer: /* w = openForWrite["dummyout.txt"] w.write["This is nice.\n"] x = 2.223432432432432 w.write[format[x,1,4] + "\n"] // Force output to a string // with 4 dec places w.write["$x"] // Also forces to a string. w.close[] */