$file.readLines
Reads lines of a text file
|
Usage |
$file.readLines(<filename>[,<startline>,[<count>[,<flags>]]])
|
Description |
Reads lines from the specified file and returns them as an array of strings.
The lines are assumed to be separated by linefeed characters (which are NOT returned).
Eventual terminating carriage return and line feed characters at the end of the line are stripped.
If <startline> is specified, then all the lines with indexes lower that <startline> are
discarded. If <count> is specified then at most this number of lines are returned,
otherwise the entire file is returned.
The <filename> is adjusted according to the system that KVIrc is running on.
Flags are actually limited to the single letter 'l'. By default the file
is decoded from the utf-8 character set, however if 'l' is present then the file
is decoded by the local 8 bit character set instead.
WARNING: Always check the size of the file you're going to read - it is not
a good idea attempting to read a 700 MiB binary file with this function since
it will probably hang your system and exhaust your virtual memory.
|
Syntax Specification |
<array> $file.readLines(<filename:string>[,<startline:integer>,[<count:integer>[,<flags:string>]]])
|
Examples |
echo $file.readLines(/proc/cpuinfo)
|
|
See also |
$file.read, file.writelines, $lf
|