Copyright 2008 Shoptalk Systems

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

Description:

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.

Example:

  '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 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)
      i=i+1
    wend
  close #f
  for j=0 to i
    print a$(j)
  next j
  end

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