$file.read Reads a text file |
Usage |
<string> $file.read(<filename:string>[,<size:integer>[,<flags:string>]]) |
Description |
Reads at most <size> bytes of the file pointed to by <filename>. If <size>
is not specified, KVIrc enforces a 1 MiB limit (so if you want to read a
file that is larger than 1 MiB then you MUST specify the <size>). The data read is returned as a string, so if the file contains binary data, expect strange results - if you want to read binary data (with null bytes inside) then take a look at $file.readbytes. 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. An empty string is returned if a serious error occurs. <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.read(/proc/cpuinfo) |
See also |
$file.readbytes |