How to input password in C

Reply

Join Date: Feb 2006
Posts: 18
Reputation: harrypotter is an unknown quantity at this point 
Solved Threads: 1
harrypotter harrypotter is offline Offline
Newbie Poster

How to input password in C

 
0
  #1
Feb 17th, 2006
Please tell me how to input password by showing a * or other symbol on console instead of text in C.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,614
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: How to input password in C

 
0
  #2
Feb 17th, 2006
You need some way of reading raw input with a non-standard solution such as getch. Then it's just a matter of handling backspaces cleanly as printing an asterisk for every printing character that you read is trivial.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 18
Reputation: harrypotter is an unknown quantity at this point 
Solved Threads: 1
harrypotter harrypotter is offline Offline
Newbie Poster

Re: How to input password in C

 
0
  #3
Feb 21st, 2006
please explain in a clear way
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 15
Reputation: agiorgio is an unknown quantity at this point 
Solved Threads: 0
agiorgio's Avatar
agiorgio agiorgio is offline Offline
Newbie Poster

Re: How to input password in C

 
0
  #4
Feb 21st, 2006
Originally Posted by harrypotter
please explain in a clear way
That wasn't clear? What Naru is saying is that there is no way in standard ANSI C to do what you are asking. However, there are extensions to the standard that allow for exactly what you want.

For example, the getch() function (part of the POSIX standard) allows you to get a single byte character from the terminal. Of course, if you're going to use this, you'll need to make sure that you have a version of the curses library to link against.
"Thou shalt not follow the Null Pointer, for Chaos and Madness await thee at its end."
- Henry Spencer
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC