Skip to content

LINE INPUT

Syntax

LINE INPUT#<file number>,<string variable>

Versions: Disk

Purpose

To read an entire line (up to 254 characters), without delimiters, from a sequential disk data file to a string variable.

Remarks

is the number under which the file was OPENed. is the variable name to which the line will be assigned. LINE INPUT# reads all characters in the sequential file up to a carriage return. It then skips over the carriage return/line feed sequence, and the next LINE INPUT# reads all characters up to the next carriage return. (If a line feed/carriage return sequence is encountered, it is preserved.) LINE INPUT# is especially useful if each line of a data file has been broken into fields, or if a BASIC-80 program saved in ASCII mode is being read as data by another program.

Example

10 OPEN "O", 1, "LIST"
20 LINE INPUT "CUSTOMER INFORMATION? "; C$
30 PRINT #1, C$
40 CLOSE 1
50 OPEN "I", 1, "LIST"
60 LINE INPUT #1, C$
70 PRINT C$
80 CLOSE 1

Output:

CUSTOMER INFORMATION? LINDA JONES  234,4  MEMPHIS
LINDA JONES  234,4  MEMPHIS
Ok

See Also

  • OPEN - Open a file for input
  • CLOSE - Close the file when done
  • INPUT# - Read data from sequential file
  • LINE INPUT - Read entire line from keyboard
  • PRINT# - Write data to sequential file
  • EOF - Test for end of file
  • LOF - Get file length