Skip to content

Commit 8a34e3c

Browse files
authored
Merge pull request #2570 from hackertron/master
Added example for flush()
2 parents 5080c9a + 5e739e8 commit 8a34e3c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/io/files.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1194,9 +1194,19 @@ p5.PrintWriter = function(filename, extension) {
11941194
this.content += data + '\n';
11951195
};
11961196
/**
1197-
* Flushes the PrintWriter object
1197+
* Clears the data already written to the PrintWriter object
11981198
* @method flush
11991199
* @example
1200+
* <div class ="norender"><code>
1201+
* // create writer object
1202+
* var writer = createWriter('newFile.txt');
1203+
* writer.write(['Flush me']);
1204+
* // flush writer object here
1205+
* writer.flush();
1206+
* // close writer
1207+
* writer.close();
1208+
* </code></div>
1209+
*
12001210
*/
12011211
this.flush = function() {
12021212
this.content = '';

0 commit comments

Comments
 (0)