TINPUT [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
TINPUT
The TINPUT statement obtains a string of characters from an input device.
The characters are echoed to the display as they are entered. If a
string or numeric variable is included in the TINPUT statement, then the
value of the string of characters entered is assigned to the variable.
TINPUT options control the maximum amount of time allowed for input, the
time required for input, the maximum number of characters that can be
input, and the line feed generated subsequent to the statement execution.
At least one option must be selected when using the TINPUT statement.
Syntax
TINPUT [var] [separator] option_clause [separator option_clause]...
{TIMEOUT [=] timeout_num_expr}
{ELAPSED [=] elapsed_num_var }
option_clause -> {CHARS [=] chars_num_expr }
{NOLF }
{WITH}
separator -> {, }
{; }
EACH individual option_clause can occur only once in a TINPUT statement.
Parameters
var The numeric or string variable to which the input is
assigned. A TINPUT statement without a var discards
the input. Characters are assigned to the variable
when you type RETURN. For string variables, note that
no character, such as a comma or a double quote, is
considered to be a data item separator or terminator
within the input string. Leading and trailing blanks
are also included in the string of characters
assigned to a string variable.
For numeric variables, the input character string is
interpreted as a numeric literal and is assigned to
the numeric variable. In this case, a comma is a
valid item separator or terminator. If using the
European format, set by the Native Language Number,
then a semicolon replaces the comma as a separator or
terminator. Any leading, embedded and trailing
blanks are suppressed. If an invalid character is
entered, then an HP Business BASIC/XL error occurs.
timeout_num_ expr Numeric expression for the maximum amount of time, in
seconds, allowed by the user to enter input. The
input time limit is determined as follows:
Value of timeout_num_ expr Input Time Limit
Zero or less Unlimited
In the range (0,255) That number of seconds
rounded to nearest
second
Greater than 255 Set to 255 seconds
If the TIMEOUT option is not selected, then the input
time limit is unlimited.
If input time is limited through the use of the
TIMEOUT option, HP Business BASIC/XL transfers
control to the next program statement when the time
limit is exceeded without assigning a new value to
the specified var.
elapsed_num_var A numeric variable to which the time, in seconds,
taken to enter the input is returned. If the ELAPSED
option is not selected, the elapsed time is not
measured. If TIMEOUT is also specified, and a
timeout occurs, elapsed_num_var is set to -256.
chars_num_expr A numeric expression that evaluates to the maximum
number of characters that can be input. Typing this
number of characters will cause the generation of an
automatic carriage return and assignment of the value
to the specified str_var. The program will then
begin execution of the next statement in the program.
NOLF Suppresses the automatic line feed normally generated
after pressing RETURN, subsequent to reaching the
TIMEOUT limit specified, or after typing in that
number of characters specified in the CHARS option.
Examples
The following examples show the TINPUT statement.
10 TINPUT String_var1$, TIMEOUT Time_limit
20 TINPUT String_var2$, ELAPSED Elapsed_time
30 TINPUT String_var3$, CHARS Num_chars
40 TINPUT String_var4$, NOLF
50 TINPUT String_var5$, WITH TIMEOUT=10, ELAPSED=Elapsed_time
60 TINPUT String_var6$, ELAPSED Elapsed time, CHARS 1, NOLF
70 TINPUT Num_var WITH ELAPSED=Elapsed_time
80 TINPUT Num_var, TIMEOUT Time_limit
90 TINPUT CHARS 2
100 TINPUT TIMEOUT 5
110 TINPUT ELAPSED Elapsed_time
120 TINPUT CHARS=1,NOLF
MPE/iX 5.0 Documentation