[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

just type as many inputs as you need separated by commas, which prevents the double question mark from appearing. If you type more data than the INPUT statement requested, the ?EXTRA IGNORED message appears, which means that the extra items you typed were not put into any variables.

Line 120 displays the word PROMPT before the question mark appears. The semicolon is required between the prompt and any list of variables.

The INPUT statement can never be used outside a program. The Commodore 64 needs space for a buffer for the INPUT variables, the same space that is used for commands.


TYPE: I/O Statement
FORMAT: INPUT# <file number> , <variable list>

Action: This is usually the fastest and easiest way to retrieve data stored in a file on disk or tape. The data is in the form of whole variables of up to 80 characters in length, as opposed to the one-at-a-time method of GET#. First, the file must have been OPENed, then INPUT# can fill the variables.

The INPUT# command assumes a variable is finished when it reads a RETURN code (CHR$ (13)), a comma (,), semicolon (;), or colon (:). Quote marks can be used to enclose these characters when writing if they are needed (see PRINT# statement).

If the variable type used is numeric, and non-numeric characters are received, a BAD DATA error results. INPUT# can read strings up to 80 characters long, beyond which a STRING TOO LONG error results.

When used with device #3 (the screen), this statement will read an entire logical line and move the cursor down to the next line.

EXAMPLES of INPUT# Statement:
 10 INPUT#1,A
 20 INPUT#2,A$,B$

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated February 10, 2002.