GW-BASIC User's Guide
LINE INPUT# Statement
Purpose:
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
RUN
CUSTOMER INFORMATION?
If the operator enters
LINDA JONES 234, 4 MEMPHIS
then the program continues with the following:
LINDA JONES 234, 4 MEMPHIS
file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/LINEINPUTF.html28/03/2004 21.29.35
GW-BASIC User's Guide
LIST Command
Purpose:
To list all or part of a program to the screen, line printer, or file.
Syntax:
LIST [line number][-line number][,filename]
LIST [line number-][,filename]
Comments:
linenumber is a valid line number within the range of 0 to 65529.
If filename is omitted, the specified lines are listed to the screen.
Use the hyphen to specify a line range. If the line range is omitted, the entire program is listed.
linenumber- lists that line and all higher numbered lines. -linenumber lists lines from the
beginning of the program through the specified line.
The period (.) can replace either linenumber to indicate the current line.
Any listing may be interrupted by pressing ctrl-break.
Examples:
LIST
Lists all lines in the program.
LIST -20
Lists lines 1 through 20.
LIST 10-20
Lists lines 10 through 20.
LIST 20-
Lists lines 20 through the end of the program.
file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/LIST.html28/03/2004 21.29.35