Arrays maintain a 'current item' value that isn't accessible (unless you use my plug-ins), but can be used by not specifying an index for your array.
When you insert into an array using any of the ARRAY INSERT commands, the STACK or the QUEUE commands, the inserted item becomes the current item.
while file end(1) = 0
read NewString$
if file end(1) = 0
array insert at bottom v_mtype() ` Add a new item to the array, which becomes the current item
v_mtype() = NewString$ ` Store the string in the current item
endif
endwhile
There are examples of stack, queue and list commands in use in the codebase under my name:
List:
http://www.thegamecreators.com/?m=codebase_view_code&i=6c72fb1f0eb1323aad0aacb21d767115
Stack:
http://www.thegamecreators.com/?m=codebase_view&i=66bdf7a5604abcf6d22bfa8b3fae388f
Queue:
http://www.thegamecreators.com/?m=codebase_view_code&i=1b1bafde877fabb221079f01fd849690
The only thing that isn't totally accurate in those pieces of code is that it is possible now to create an empty array:
dim v_mtype() as mtype ` No size means zero size, or you can use -1 instead
One further thing is that the end of file is not set when you've read the last item in the file. It is set when you try to read from the file and there's nothing left to read - ie, with 5 lines in a file, you won't get FILE END(1) set to 1 until the 6th read.