Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
input [2019/05/28 10:19] neilsinput [2019/09/20 07:51] (current) neils
Line 3: Line 3:
 Syntax: Syntax:
  
-  input <string pointer destination>, <byte max_length> [,<string pointer mask>]+  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//. 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//.
Line 11: Line 11:
  
 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. 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: Examples:
  
 +  rem -- initialize a buffer first
 +  dim buff![21]
 +  name$ = @buff!
   rem -- input any string, max 20 chars and store it to name$   rem -- input any string, max 20 chars and store it to name$
   input name$, 20   input name$, 20
 +  
   rem -- input a numeric string, max 6 chars   rem -- input a numeric string, max 6 chars
 +  rem -- assume a buffer has been initialized
   input num$, 6, "0123456789-"   input num$, 6, "0123456789-"
 +  
   rem --input a string, allowing alphanumeric chars only   rem --input a string, allowing alphanumeric chars only
 +  rem -- assume a buffer has been initialized
   input a$, 10, "0123456789abcdefghijklmnopqrstuvwxzy"   input a$, 10, "0123456789abcdefghijklmnopqrstuvwxzy"