Copyright 2008 Shoptalk Systems

LINE INPUT [[#handle,]|[prompt$;] var [, var2...]


This gets the next data line from the user or from a file and assigns the value to var.  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.


  'Display each line of a text file
  input "Please type a filename"; filename$
  open filename$ for input as #text
  if eof(#text) <> 0 then [quit]
  line input #text, item$
  print item$
  goto [loop]
  close #text
  print "Done."


Line Input allows input directly multiple variables and arrays.

  file$ = "readme.txt"
  dim a$(3000)
  open file$ for input as #f
    while not(eof(#f))
      line input #f, a$(i)
  close #f
  for j=0 to i
    print a$(j)
  next j

See also: INPUT, INPUT$ (#h, n), INPUTTO$(#h, delim$)