I'm a little stuck with this. I'm trying to use a loop to add items to an array, but I'm not quite sure how to predefine the size of an array without initially adding anything to it. I was reading in lines from a text doc, and wanted each line to be an item in the array.
Here is what I was trying, and it didnt seem to be adding to the array, only replacing the last item:
$fileId = `fopen "C:\\temp\\sample.txt" "r"`;
string $nextLine = `fgetline $fileId`;
while ( size( $nextLine ) > 0 )
int $i = 0;
global string $testArray;
$testArray[$i] = $nextLine;
$nextLine = `fgetline $fileId`;
for ($item in $testArray)
print ($item + "\n");
Any help would be appreciated. Thanks.