Writer.frink

Download or view Writer.frink in plain text format


// 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[]  */


Download or view Writer.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19944 days, 15 hours, 14 minutes ago.