I am having trouble getting the right code to look at a .txt file and print a random word from a list, going down the .txt file. I can get it to open the file which i think is:
OPEN "whatever" FOR INPUT AS ?
and then print ?
I am a bit stuck. Sorry if the question is hard to understand. Thanks
TP :rolleyes:
Oh, by the way, this is in QBASIC!

CLS
RANDOMIZE TIMER
OPEN "test.txt" FOR INPUT AS #1
DIM wds$(1000)
count% = 0
WHILE NOT EOF(1)
LINE INPUT #1, LL$
FOR K% = 1 TO LEN(LL$)
IF MID$(LL$, K%, 1) = " " OR K% = LEN(st$) THEN
count% = count% + 1
wds$(count%) = RTRIM$(MID$(LL$, LastK% + 1, K% - LastK%))
LastK% = K%
END IF
NEXT K%
test% = RND * count%

PRINT wds$(test%)
FOR K% = 1 TO count%: wds$(K%) = "": NEXT
count% = 0: LastK% = 0
WEND
CLOSE #1