Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 261: | Line 261: | ||
=== Object File === | === Object File === | ||
This object is returned file () | This object is returned by the file() method and provides access to the requested file. If the file with the specified name does not exist yet, it will be created. After reading or writing, the file should be closed using the method close(). | ||
==== Methods ==== | ==== Methods ==== | ||
Line 268: | Line 268: | ||
; readLine() | ; readLine() | ||
: | : Reads a line. | ||
; readLines() | ; readLines() | ||
: | : Reads the remaining lines in the file, returning them in an array. | ||
; readChar() | ; readChar() | ||
: | : Reads a character. | ||
; write(text) | ; write(text) | ||
: Write | : Write string(s). This function takes a variable number of arguments, converts each argument to a string, and writes that string to the file. | ||
; writeLine(text) | ; writeLine(text) | ||
Line 283: | Line 283: | ||
; close() | ; close() | ||
: Close the file. It | : Close the file. It can be subsequently reopened. | ||
==== | ==== Properties ==== | ||
; exists : true - if and only if the file denoted by this object exists; false otherwise | ; exists: true - if and only if the file denoted by this object exists; false otherwise | ||
; length : The length, in bytes, of the file denoted by this object, or 0L if the file does not exist. | ; length: The length, in bytes, of the file denoted by this object, or 0L if the file does not exist. | ||
; getLineNumber : Get the current line number. | ; getLineNumber: Get the current line number. | ||
=== Examples === | === Examples === |