delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/06/05:15:28

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Amber N. Stange" <nicci AT eluviis DOT ohsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: password and masking
Date: Wed, 6 Mar 2002 04:14:02 -0600
Organization: Navix Internet Subscribers
Lines: 27
Message-ID: <a64q59$psf$1@iac5.navix.net>
NNTP-Posting-Host: cras7p1.navix.net
X-Trace: iac5.navix.net 1015409641 26511 162.40.84.195 (6 Mar 2002 10:14:01 GMT)
X-Complaints-To: abuse AT navix DOT net
NNTP-Posting-Date: 6 Mar 2002 10:14:01 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am wanting to (for lack of a better word) mask a password for a login as
the user types the password.  For instance much like Linux displays nothing
when a password is entered upon an attempted login.

Well, in this specific case I am using fgets to get the password information
but of course that does me no good until enter has been pressed.  What I was
wanting to mask the password with was, "*"  (asterisks) much like many other
logins in other OSs and the old BBSs used to do.

I have found thusfar that kbhit(); seems to be worthless for this.  I have
thought about using a do { } while();   loop and testing with kbhit(); for
every keypress then once a keypress has been detected (ie, if(kbhit() !=0))
set my pointer that points to fgets = to an enter copy the single char to a
string do a \b for a backspace and printf an asterisk and do it all over
again and again until the user hits enter or some other method of ending my
do while loop.

I dont know if this works or would work and I am trying to implement it..
But I am wondering if I am going about this the wrong way..  If so is there
another way to do this?  If my method will work is there an easier way that
I am not thinking of minus setting up a ASM keyboard routine to get the
actual keypress codes or scan codes rather..

Regards,
Mrs. Amber Nicole Stange


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019