PSS ID Number: 123690
Article Last Modified on 11/3/1999
include 'flib.fi'
C Compile options needed: none
include 'flib.fi'
integer*2 function getch
include 'flib.fd'
record /regs$info/ in,out
in.bregs.ah=#08 ! Function 8 - STDIN Input (no echo)
call intdosqq(in,out) ! Int 21h
getch=out.bregs.al ! Input data returned in AL
return
end
C Compile options needed: none
include 'flib.fi'
subroutine putchar( ch )
include 'flib.fd'
record /regs$info/ in,out
character*1 ch
in.bregs.ah=#02 ! Function 2 - Display Output
in.bregs.dl=ch ! Character to display goes in DL
call intdosqq(in,out) ! Int 21h
return
end
include 'flib.fi'
program password
character*80 pass
logical get_pass/.true./
integer*2 i,j,getch
write(*,'(1x,a,\)') 'ENTER PASSWORD > '
i=1
do while (get_pass)
j=getch() ! Get a character of the password
if (j.le.32) then
if (j.eq.8.and.i.gt.1) then ! BACKSPACE key pressed
i=i-1
call putchar( char(j) )! Move cursor back one character
call putchar( ' ' ) ! Write a blank over the asterisk
call putchar ( char(j) )! Move cursor back to blanks
pass(i:i+1) = ' '
endif
if (j.eq.13) get_pass=.false.! ENTER key pressed -- exit
else
call putchar( '*' ) ! Echo asterisk to display
pass(i:i)=char(j) ! Add input character to string
i=i+1
if (i.gt.80) get_pass=.false. ! Don't write past string end
endif
enddo
write(*,*)
write(*,*) 'password entered > ',pass
end
C Compile options needed: none
include 'flib.fi'
integer*2 function kbhit
include 'flib.fd'
record /regs$info/ in,out
in.bregs.ah=#0B ! Function B - Get STDIN Status
call intdosqq(in,out) ! Int 21h
kbhit=out.bregs.al ! Input data returned in AL
return
end
Additional query words: kbinf 5.10 getc getchar console putc
Keywords: KB123690
Technology: kbAudDeveloper kbFORTRAN510DOS kbFortranSearch kbZNotKeyword3