Syntax:
input <string pointer destination>, <byte max_length> [,<string mask>]
The INPUT
command calls a built-in routine that allows the user to input a string using the keyboard. The user input will be limited to max_length characters. After the user has pressed the RETURN
key, the input will be copied to the string pointed by destination.
No prompt string (e. g. ?
in CBM BASIC) is displayed. Line editing features are limited to the DELETE
button, moving the cursor is not allowed.
Warning: the buffer that the string pointer points to must be wide enough to accept the user input, otherwise buffer overflow will occur!
Examples:
rem -- initialize a buffer first dim buff![21] name$ = @buff! rem -- input any string, max 20 chars and store it to name$ input name$, 20 rem -- input a numeric string, max 6 chars rem -- assume a buffer has been initialized input num$, 6, "0123456789-" rem --input a string, allowing alphanumeric chars only rem -- assume a buffer has been initialized input a$, 10, "0123456789abcdefghijklmnopqrstuvwxzy"
Note: to convert a string to a numeric type, use the VAL()
function.
This command has been completely rewritten since version 2.0 and is incompatible with that of version 1.x.