try the code below.
it read the file in an array that grows dynamically.
at the end, the array is truncated to the right size.

Function ReadFileToArray($filename)
Dim $handle
$handle=freefilehandle()
if open($handle,$filename)<>0
exit @error
endif

;-- prepare the array with an initial size --
Dim $incr, $size, $line, $index
$incr = 128
$size = $incr
dim $arr[$size]

;-- read file and put each line in the array --
$index = -1
$line = ReadLine($handle)
while not @error
$index = $index + 1
if $index>UBound($arr)
$size = $size + $incr
redim preserve $arr[$size]
endif
$arr[$index] = $line

$line = ReadLine($handle)
loop
;-- truncate the array to the minimum size --
redim preserve $arr[$index]

;-- close the file --
$_=close($handle)

;-- set the return data --
$ReadFileToArray=$arr
exit 0
EndFunction
_________________________
Christophe