Hello

from my MAIN-Routine the script calls a function to build an array from an input file. In the function are some print commands to the console to show the values of the array and the counter for the array index. This so far works fine. In the MAIN-Routine (after the function call) I do also a print command to the console and can see that the array does not show the expected value; also the array lost 2 entries. Have no idea what this could be. Any help is very appreciated.
Bjoern



Code:
 
;******* Build the Kategories Array **************************************************************
Global $KatArray[100]
BuildArray()

? $KatArray[0]


;******* Functions: General **********************************************************************
; (F01) BuildArray
;
;
;
;*************************************************************************************************

;******* Functions: (F01) Build Array ************************************************************
;
;*************************************************************************************************

Function BuildArray()

Dim $F01Handle
Dim $F01RC
Dim $F01Line
Dim $F01Index

$F01Handle = FreeFileHandle ()

$F01RC = Open($F01Handle, "BLOCKED-KATEGORIEN.TXT",2)

$F01Index = 0

$F01Line = ReadLine($F01Handle)
$KatArray[$F01Index] = $F01Line

? $KatArray[$F01Index]

While $F01Line <> "" And @ERROR = 0

$F01Line = ReadLine($F01Handle)
$KatArray[$F01Index] = $F01Line
? $KatArray[$F01Index]
$F01Index = $F01Index + 1

Loop

? $F01Index

ReDim Preserve $KatArray[$F01Index]

$F01RC = Close($F01Handle)

EndFunction