$file.readLines Reads lines of a text file |
Usage |
<array> $file.readLines(<filename:string>[,<startline:integer>,[<count:integer>[,<flags:string>]]]) |
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 than <startline> are discarded. If <count> is specified then at most this number of lines are returned, otherwise the entire file is returned. 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 file with this function since it will probably hang your system and exhaust your virtual memory. <filename> is adjusted according to the Windows or UNIX system that KVIrc is running on. If the single l flag is present, the file is decoded with the local 8-bit character set, otherwise UTF-8 is used. |
Examples |
echo $file.readLines(/proc/cpuinfo) |
See also |
$file.read, file.writelines, $lf |