file=ReadFile("MyFile.txt") If Not file RuntimeError "could not open file" Global count=0, stringarray$[] While Not Eof(file) ' Increase the total number of lines that have been read count:+1 ' Resize the array to hold one more line from the file stringarray = stringarray[..count] ' Store the line in the array at the last index stringarray[count-1] = ReadLine(file) Wend CloseStream file For Local n = 0 Until count Print stringarray[n] Next
This will do the trick.
I'm using almost the same code in VB (in VB6 syntax of course) for reading a textfile (subtitles for DivX movies) into an array, processing the array to find misspelled words and then save the array to a new file.
But in VB, I used a preset size for the array (10.000 lines).