LINE INPUT# - DualBrain/bsharp GitHub Wiki

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

Syntax

LINE INPUT# file number, string variable

Comments

file number is the number under which the file was opened.

string variable 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. If a line feed/carriage return sequence (this order only) is encountered, it is input.

LINE INPUT# is especially useful if each line of a data file has been broken into fields, or if a BASIC program saved in ASCII mode is being read as data by another program.

Examples

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

If the operator enters

 LINDA JONES 234, 4 MEMPHIS

then the program continues with the following:

 LINDA JONES 234, 4 MEMPHIS