943,566 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 5471
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 6th, 2007
0

Hiding Password on the login screen

Expand Post »
Hi All,

I am writing a code in C++ to implement Login screen which will accept user name and password from the user. Now my main concern is to hide that password to be sceen by the user.

suppose my password is "Rat420" so at the time of typing anything i want it to appear as "******".

That means i need "*" to be seen on screen for each and ever character, and the original password is not lost.
Similar Threads
Reputation Points: 25
Solved Threads: 0
Light Poster
RohitSahni is offline Offline
35 posts
since Jul 2007
Nov 7th, 2007
0

Re: Hiding Password on the login screen

That depends. What I/O interface are you using?

Is it a console process? Are you using a GUI? What OS? What widget set?
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Nov 7th, 2007
0

Re: Hiding Password on the login screen

There is no way to do this in standard C++. There are non-standard ways to get the job done, some of which are in common use, though. Knowing at least some of the information asked by Duoas will be necessary to try to help inform you of which non-standard methods may be available to you.
Reputation Points: 718
Solved Threads: 373
Nearly a Posting Maven
Lerner is offline Offline
2,253 posts
since Jul 2005
Nov 7th, 2007
0

Re: Hiding Password on the login screen

Yes it is a console process.
i am using Unix and using Sun C++ compiler
and also i am using GUI.
Reputation Points: 25
Solved Threads: 0
Light Poster
RohitSahni is offline Offline
35 posts
since Jul 2007
Nov 7th, 2007
0

Re: Hiding Password on the login screen

>>also i am using GUI
You mean the compiler is has a GUI interface ? I think you will probably have to use the curses library.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
Nov 7th, 2007
0

Re: Hiding Password on the login screen

Agreed. If I remember correctly, the curses library actually has a function that does what you want...
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Nov 7th, 2007
0

Re: Hiding Password on the login screen

Reputation Points: 1486
Solved Threads: 140
Practically a Posting Shark
siddhant3s is offline Offline
816 posts
since Oct 2007
Nov 7th, 2007
0

Re: Hiding Password on the login screen

That code will not work in unix. The idea to use a loop to get characters is fine, but you will still need to use curses to unbuffer your stdin.

(Besides wish, that code is old and non-standards compliant.)
Last edited by Duoas; Nov 7th, 2007 at 6:58 am.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Nov 7th, 2007
0

Re: Hiding Password on the login screen

Honey try reading the below:
http://www.daniweb.com/forums/thread77633.html
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Nov 8th, 2007
0

Re: Hiding Password on the login screen

There is a Buit in function called getpass in conio.h

Prototype : char *getpass(const char *prompt);

Displays the prompt string and then reads the password without echoing. Returns a pointer to a static string containing the input password.
Usage://include the conio.h and string.h

char a[20];

strcpy(a,getpass("Enter Pass"));
cout<<a;
Reputation Points: 1486
Solved Threads: 140
Practically a Posting Shark
siddhant3s is offline Offline
816 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: HELP ME
Next Thread in C++ Forum Timeline: Want to learn GUI bsed C++ programming





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC