Quote:| Could someone let me know please how to open a .txt file using bb4w and then to read the contents into variables |
|
You don't say whether you want to use separate variables or an array. Assuming you will use an array (and that you know the maximum number of items you'll want to read) the code would be something like this:
Code:
DIM text$(max%)
index% = 0
file% = OPENIN(@dir$+"spanish.txt")
IF file% = 0 ERROR 100, "Couldn't open spanish.txt"
REPEAT
INPUT #file%, text$
IF ASC(text$) = 10 text$ = MID$(text$,2)
index% += 1
text$(index%) = text$
UNTIL EOF#file% OR index% = max%
CLOSE #file%
total% = index%
Richard.