Basic computer language commands

Basic computer programming language

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.

BASIC commands Main Menu

Index