E r g e b n i s / R e s u l t
Prompts the user for a string, echoing '*' to the screen
B e s c h r e i b u n g / D e s c r i p t i o n
This procedure is used to prompt the user for a string and does not
display that string on the screen. Instead, it displays a '*' for each
character typed.
Using this function the user can prompt for a secret password, knowing
that nothing will appear on the screen.
S y n t a x
Code:
password = call('PASSWORD' , length) P a r a m e t e r
length - An integer parameter specifying the maximum length of the
password is passed to this function.
If the user tries to type a string longer than the parameter,
the computer will beep.
R e t u r n s
The procedure returns a string value. This is the string typed by
the user.
If the user presses Escape, a zero length string is returned.
If the user presses Enter or F10 on a blank password, then a 1 character
space is returned.
B e i s p i e l / E x a m p l e
Code:
! This routine demonstrates how to use the Open Access 'C' Language
! routine PASSWORD.
! attach the c hook
attach "keyboard"
done = false
! loop until escape is pressed
while not done
! prompt the user
put at 10,10 mode title 'Please enter your password: '
! call the password routine. It returns a string, in this case into the
! variable a. The password width is set to 8.
a = call("password",8)
! users of the Compiler please note that the above command would be
! a = (* str) call("password",8)
put do newline
put do newline
put do newline
! display the password just typed in
put mode normal length(a) , ' ' , a , do clear end line
put do newline
put do newline
put do newline
! was escape pressed ? If so end the loop
if length (a) = 0
done = true
end if
end while
! remove the c hook from memory
detach "keyboard" Q u e r v e r w e i s / C r o s s R e f e r e n c e
GET_CH
GET_CHE
FLUSHBUF