BTW there are more advanced ways to access a file that give up and down and all around flexibility for access but that is not a place to start. OPEN FOR INPUT is classic way to start learning file access. There are more flexible arrays that are started with REDIM, but again, that is not classic way to start learning arrays.
Question #1 about arrays, how big?
Because before you can use an array you have to DIM it (exceptions to almost every rule like if array size <=10 you don't have to DIM but I would anyway because you can then change to bigger by just changing number).
Think of DIM as reserving space in the computer memory bank. For variables reservations are easy they are known size but arrays? how many of these variables are wanting or be needing for the array though? You tell it through DIM statement DIM myArray$(100) that reserves space for 101 lines from 0 to 100. Now we can go from myArray$(0) to myArray$(100) without QB64 telling us our "subscript is out of bounds" referring to the number inside the parenthesis. It is usually called the index and it is usually given the variable name i, i for index.
OK so an array for our file, how big is that going to have to be? Most times we don't know and we just count the lines first like I did, so I knew not to go past a certain line number in file.
As usual with QB64 there are other ways to approach loading a file with unknown size into an array but let's stick with classic way from QB upon which QB64 was based, actually from GW BASIC upon which QB was based.
So enough lecture:
'count lines in file
'PRINT a
'INPUT " OK enter "; w$
IF LEN(_TRIM$(a
)) THEN count
= count
+ 1 'make sure we count real lines with stuff AKA contents
'set the size of the array
DIM myArray$
(count
) ' we will leave myArray$(0) empty so that the Upper Bound of array matches the number of lines with stuff in them
Is that enough of a hint? Do you have that already?
Can you guess the next step: How to load the array? We practically have the code already! just add copy/paste and add or change one line.