$file.readBytes Reads a binary file |
Usage |
<array> $file.readBytes(<filename:string>[,<size:integer>]) |
Description |
Reads at most <size> bytes of the file pointed to by <filename>
and returns it as an array of integers (bytes). 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>). If you want simple text data then take a look at $file.read. 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. An empty array (or just nothing) is returned if a serious error occurs. <filename> is adjusted according to the Windows or UNIX system that KVIrc is running on. |
Examples |
echo $file.readBytes(/proc/cpuinfo) |
See also |
$file.read, file.writebytes |