Liberty BASIC Help Online |
INPUTTO$(#h, c$)
INPUTTO$(#handle, delim$))
Description:
This function reads from the file #handle up to the character specified in delim$ or to the end of the line, whichever comes first. This is handy for reading files which contain comma, tab, pipe, or other delimited items.
'display each comma delimited item in a file on its own line
open "inputto test.txt" for input as #test
while eof(#test) = 0
print inputto$(#test, ",")
wend
close #test
Inputto$ directly to an array
You can use inputto$() to fill an array directly:
dim array$(500)
filedialog "Open","*.txt",file$
open file$ for input as #test
while eof(#test) = 0
array$(total)=inputto$(#test,",")
print array$(total)
total=total+1
if total>=500 then exit while
wend
close #test
for i = 0 to total
print array$(i)
next
end
Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/