- Easy way to save strings to file system are using
saveStrings()
andsaveStream()
. saveStrings()
a list into a target file- You can allow user to select a target file using
selectOutput()
beginRecord() and endRecord()
can be used to continuously write to the file system what is written to the screen.import processing.pdf.*; void setup() { size(400, 400); beginRecord(PDF, "drawings.pdf"); } void draw() { ellipse(mouseX, mouseY, 10, 10); } void mousePressed() { endRecord(); exit(); }
String names = "thej raj simran me";
String[] nameslist = split(names, ' ');
saveStrings("names.txt", nameslist);
String names = "thej raj simran me";
String[] nameslist = split(names, ' ');
String savePath = selectOutput("Please select a file to save the names ");
saveStrings(savePath, nameslist);