filehandle::read([format])
Reads the file according to the format specified (see below). For each format, it returns a string (or number) with the characters read or nil if it cannot read data with the specified format.
"*n" |
Reads a number and returns a number (not a string). |
"*a" |
Reads the whole file, starting at the current position. On end of the file it returns an empty string. |
"*l" |
The default. It reads the entire next line (skipping the end of line), returning nil on the end of the file. |
number |
Reads a string with up to this number of characters, returning nil on the end of the file. If the number is zero, it reads nothing and returns an empty string or nil on the end of the file. |
The following reads the next line (in this case, the first one) in the file opened in the example above:
> str = fid::read() // str will be a string of the read values or nil