943,341 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 7302
  • C++ RSS
Aug 26th, 2004
0

Input a "password" string

Expand Post »
I :cheesy: want to input a string but instead of showing the real characters on the screen, i want all to be astericks. Can anybody help me to solve this?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hail2dthief is offline Offline
10 posts
since Aug 2004
Aug 27th, 2004
0

Re: Input a "password" string

On a windows dialog? In VC++ you can edit the properties of an edit control and one of the properties is to use asterisks instead of text for password fields.
Reputation Points: 36
Solved Threads: 11
Posting Pro in Training
Chainsaw is offline Offline
436 posts
since Jun 2004
Aug 27th, 2004
0

Re: Input a "password" string

No, not on a windows dialog. Actually i'm writing a program in dos mode and want to set up a password. Is there any c++ function that can help me to solve this?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hail2dthief is offline Offline
10 posts
since Aug 2004
Aug 27th, 2004
0

Re: Input a "password" string

tHis is just my guess but try doing.....
cout << "* ";
is that what your talking about?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hfick is offline Offline
18 posts
since Aug 2004
Aug 27th, 2004
0

Re: Input a "password" string

Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Aug 27th, 2004
0

Re: Input a "password" string

No, that's not what i'm talking about. What I want is when I enter a string, the asterisks will come out on the screen. Just like when you enter your password to log in to this website.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hail2dthief is offline Offline
10 posts
since Aug 2004
Aug 27th, 2004
0

Re: Input a "password" string

Quote originally posted by hail2dthief ...
No, that's not what i'm talking about. What I want is when I enter a string, the asterisks will come out on the screen. Just like when you enter your password to log in to this website.
Please reread the part of that link that describes exactly that.
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Aug 27th, 2004
0

Re: Input a "password" string

Thanks, Dave. I'll try it out and see if it can sole the problem or not.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hail2dthief is offline Offline
10 posts
since Aug 2004
Aug 27th, 2004
0

Re: Input a "password" string

C++ Syntax (Toggle Plain Text)
  1. //Warning,written by hand.Mistakes are possible
  2.  
  3. void pass(char *s,int len,char mask='*')
  4. {
  5. int loc = 0;
  6. char p;
  7. int x = getx();
  8. int y = gety();
  9.  
  10. do
  11. {
  12. p = getch();
  13. if(p == '\r') // \r = enter
  14. {
  15. s[loc] = 0;
  16. break;
  17. }
  18. else if(p == '\b') // \b means backspace
  19. {
  20. if(loc>0)
  21. {
  22. s[loc]=0;
  23. loc--
  24. gotoxy(x-1,y);
  25. cout<<" ";
  26. gotoxy(--x,y);
  27. }
  28. }
  29. else
  30. {
  31. s[loc++] = p;
  32. x++;
  33. cout<<m;
  34. }
  35.  
  36. }
  37. while(true);
  38. }
Reputation Points: 108
Solved Threads: 7
Posting Whiz in Training
FireNet is offline Offline
256 posts
since May 2004
Aug 27th, 2004
0

Re: Input a "password" string

Thanks, guys. Problem solved.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hail2dthief is offline Offline
10 posts
since Aug 2004

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: merged:nesting loops
Next Thread in C++ Forum Timeline: New to C++ Pointers and need help with identifying where the errors are





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


Follow us on Twitter


© 2011 DaniWeb® LLC