Entering passwords in C++

This is a discussion on Entering passwords in C++ within the C++ Programming forums, part of the General Programming Boards category; I need to be able to mask string inputs. That is, when you enter a password, an asterisk (****) appears ...

  1. #1
    Unregistered
    Guest

    Entering passwords in C++

    I need to be able to mask string inputs. That is, when you enter a password, an asterisk (****) appears instead of the actual character. Is this possible? If so, how?

    Thanks

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    You'll have to find some system dependant method of getting input that doesn't echo itself on the screen. getch() in conio.h does this on most compilers.

    Then every time you read an input, output an asterisk. You'll have to handle things like backspaces yourself aswell.
    zen

  3. #3
    Registered User darketernal's Avatar
    Join Date
    Sep 2001
    Posts
    41

    Cool

    maby something like this?

    void __fastcall TForm1::Button1Click(TObject * Sender)
    {
    AnsiString String1 = Edit1->Text;
    AnsiString String2 = "enter";
    int i = CompareStr (String1, String2);
    if (i != 0)
    {
    Showmessage ("password incorrect");
    }
    else
    ShowMessage ("password correct");
    }
    --------------------------------------------------

    sorry if this didn't help, anywayz in a c++ builder you can
    modefy this aspect in the Object inspector under Property's.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. vBulletin vandals and the wisdom of randomly generated passwords
    By abachler in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-08-2008, 05:27 PM
  2. Entering an email...the correct way!
    By ultrabot90 in forum C++ Programming
    Replies: 20
    Last Post: 10-31-2007, 04:52 AM
  3. Database programming and passwords
    By Squintz in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2003, 09:05 PM
  4. Score Entering
    By ryn in forum C++ Programming
    Replies: 4
    Last Post: 03-26-2002, 11:11 PM
  5. What is the best way to use passwords?
    By GreenCherry in forum C++ Programming
    Replies: 1
    Last Post: 03-22-2002, 11:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21