Name |
PrintWriter打印文本输出 |
||||||||
Examples |
PrintWriter output;
void setup() { // Create a new file in the sketch directory output = createWriter(“positions.txt”); }
void draw() { point(mouseX, mouseY); output.println(mouseX); // Write the coordinate to the file }
void keyPressed() { output.flush(); // Writes the remaining data to the file output.close(); // Finishes the file exit(); // Stops the program } |
||||||||
Description |
Allows characters to print to a text-output stream. A new PrintWriter object is created with the createWriter() function. For the file to be made correctly, it should be flushed and must be closed with its flush() and close() methods (see above example). 允许字符打印到文本输出流。使用 createWriter () 函数创建一个新的 PrintWriter 对象。为了使文件能够正确地进行, 它应该被刷新, 并且必须用它的刷新 () 和 close () 方法关闭 (请参见上面的示例)。 |
||||||||
Methods |
|
||||||||
Constructor |
|
||||||||
Related |
- 本文固定链接: http://iprocessing.cn/2017/08/02/printwriter打印文本输出/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表