There are two ways you can do this:
First method would be to loop through the file twice. The first time just to get a count of how many lines there are, then create your array with that many lines. Then you would loop through again to actually add each line to one of the array slots.
Example:
String filename = "C:\test.txt"
Stream input = read filename
string str
int star = 0
while (true)
{
input >> str
if(end of input) break
star++
}
string strArray[star]
input = read filename
star = 0
while (true)
{
input >> str
if(end of input) break
strArray[star] = str
star++
}
// Do your code with the array here
The second method, and the easier way to do it, is to use a skip list instead of an array.
Example:
String filename = "C:\test.txt"
Stream input = read filename
string str
int star = 0
Skip fileLines = create
while (true)
{
input >> str
if(end of input) break
put(fileLines, star, str)
star++
}
for str in fileLines do
{
print str "\n"
}
delete fileLines
Don't forget the last line in there which is to delete the Skip list and release the resources.