Liberty BASIC Help Online

LINE INPUT
 
line input #handle, var$
 
Description:
This gets the next data line from the open file or device using handle #handle and assigns the data to var$.  If no device or file exists that uses the handle named #handle, then it returns an error. The line input statement reads from the file, ignoring commas in the input stream and completing the data item only at the next carriage return or at the end of file.  This is useful for reading text with embedded commas
 
Usage:
 
  'Display each line of a text file
  input "Please type a filename >";  filename$
  open filename$ for input as #text
[loop]
  if eof(#text) <> 0 then [quit]
  line input #text, item$
  print item$
  goto [loop]
[quit]
  close #text
  print "Done."
 
Arrays:
Line Input now allows input directly multiple variables and arrays.
 
filedialog "Open","*.txt",file$
if file$="" then end
dim a$(3000)
 
open file$ for input as #f
 
while not(eof(#f))
    line input #f, a$(i)
    i=i+1
wend
 
close #f
 
for j=0 to i
    print a$(j)
next
 
end
 
 
 
See also: INPUT, Input (#h, n), INPUTTO$(#h, c$)


Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/