PrintWriter not working
in
Programming Questions
•
8 months ago
I'm a Processing noob and have a very basic question about PrintWriter, which I can't get to work at all. I've tried it several times with various bits of code and each time get the same error message on the line where the PrintWriter object is created: "cannot convert from PrintWriter to PrintWriter". The code below is lifted straight from the reference page on the Processing website and generates the same error:
PrintWriter output;
void setup() {
// Create a new file in the sketch directory
output = createWriter("positions.txt");
}
void draw() {
point(mouseX, mouseY);
output.println(mouseX + "t" + mouseY); // 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
}
1