Input Statement

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

GW-BASIC User's Guide

INPUT# Statement
Purpose:
To read data items from a sequential file and assign them to program variables.

Syntax:
INPUT# file number, variable list

Comments:
file number is the number used when the file was opened for input.
variable list contains the variable names to be assigned to the items in the file.
The data items in the file appear just as they would if data were being typed on the keyboard in
response to an INPUT statement.
The variable type must match the type specified by the variable name.
With INPUT#, no question mark is printed, as it is with INPUT.

Numeric Values
For numeric values, leading spaces and line feeds are ignored. The first character encountered
(not a space or line feed) is assumed to be the start of a number. The number terminates on a
space, carriage return, line feed, or comma.

Strings
If GW-BASIC is scanning the sequential data file for a string, leading spaces and line feeds are
ignored.
If the first character is a double quotation mark ("), the string will consist of all characters read
between the first double quotation mark and the second. A quoted string may not contain a
double quotation mark as a character. The second double quotation mark always terminates the
string.
If the first character of the string is not a double quotation mark, the string terminates on a
comma, carriage return, line feed, or after 255 characters have been read.
If end of the file is reached when a numeric or string item is being INPUT, the item is terminated.
INPUT# can also be used with random files.

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/INPUTF.html28/03/2004 21.29.32

You might also like