Sidebar

How do I write out to a file?

0 votes
535 views
asked Feb 5, 2014 by ron-s-6919 (4,480 points)
I would like to output content to a file.  Can I use Java functions to write the contents of my message to a file on the file system?

1 Answer

0 votes
 
Best answer
You can use the Java IO library to write the contents of any variable out to a file as follows:
 
// write bytes out to a file
var out = new java.io.FileOutputStream('C:\\QIE\\tmp.txt', false);
var bytes = message.getBytes();
out.write(bytes);
out.close();
answered Feb 5, 2014 by ron-s-6919 (4,480 points)
edited Mar 6, 2019 by ben-s-7515
...