Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
input [2019/05/29 21:33] neils |
input [2019/09/20 07:51] (current) neils |
||
---|---|---|---|
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" | ||