Creates a new p5.PrintWriter object.
p5.PrintWriter objects provide a way to save a sequence of text data, called the print stream, to the user's computer. They're low-level objects that enable precise control of text output. Functions such as saveStrings() and saveJSON() are easier to use for simple file saving.
The first parameter, filename
, is the name of the file to be written. If a string is passed, as in createWriter('words.txt')
, a new p5.PrintWriter object will be created that writes to a file named words.txt
.
The second parameter, extension
, is optional. If a string is passed, as in createWriter('words', 'csv')
, the first parameter will be interpreted as the file name and the second parameter as the extension.
Ejemplos
Sintaxis
createWriter(name, [extension])
Parámetros
name of the file to create.
format to use for the file.