Skip to content

Instantly share code, notes, and snippets.

@memish
Created October 17, 2018 11:52
Show Gist options
  • Save memish/28bd8b6ce09879b0fe1b0d756857b5ba to your computer and use it in GitHub Desktop.
Save memish/28bd8b6ce09879b0fe1b0d756857b5ba to your computer and use it in GitHub Desktop.
BufferedReader reader;
String line;
void setup() {
// Open the file from the createWriter() example
reader = createReader("positions.txt");
}
void draw() {
try {
line = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
line = null;
}
if (line == null) {
// Stop reading because of an error or file is empty
noLoop();
} else {
String[] pieces = split(line, TAB);
int x = int(pieces[0]);
int y = int(pieces[1]);
point(x, y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment