# $file.readBytes

Reads a binary file

Usage

    $file.read(<filename>[,<size>])

Description

Reads at most <size> bytes of the file pointed by <filename> and returns it as an array of integers (bytes). <size> is an upper limit but may be not reached if the real file is smaller.
If <size> is not specified, then KVIrc tries to read the whole file up to the 1 MiB limit (so if you want to read a file that is bigger 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 file size before attemting to read a whole file... reading a CDROM iso image may sit down your system :) (and will probably crash while allocating memory, before attempting to read anything)
An empty array (or just "nothing") is returned if a serious error occures.
The <filename> is adjusted according to the system that KVIrc is running on.

Syntax Specification

    <array> $file.read(<filename:string>[,<size:integer>])

Examples

        echo $file.readBytes(/proc/cpuinfo)

See also
$file.read, file.writebytes

Index, Functions

KVIrc 4.2.0.6190 Documentation
Generated by root at Mon Sep 23 13:56:02 2013