Thread: guidence

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    8

    guidence

    i`m making a game were the user has to type in there password and instead of seeing the actual password i need to know how to just show the *** sign


    just give me a link to a tutorial or something, i`m not asking for help i`m just asking for guidence

    -eldian()

  2. #2
    Open to suggestions Brighteyes's Avatar
    Join Date
    Mar 2003
    Posts
    204
    Here's a quick and dirty way to do it using conio and getch. Substitute your own nonblocking read where appropriate:
    Code:
    #include <iostream>
    #include <string>
    #include <conio.h>
    
    using namespace std;
    
    static string getPass()
    {
        string pass;
        int i;
        int ch;
    
        while ((ch = getch()) != '\r')
        {
            if (ch == '\b')
                cout<<"\b\b  \b\b";
    
            pass += (char)ch;
            cout.put('*');
        }
    
        return pass;
    }
    
    int main(void)
    {
        string password = getPass();
    
        cout<<"\n"<< password <<endl; /* Test print: Does it work? */
    
        return 0;
    }
    p.s. What the alphabet would look like without q and r.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A little guidence needed
    By Matty_Alan in forum Game Programming
    Replies: 20
    Last Post: 12-17-2008, 06:41 AM
  2. guidence to a program C
    By nurofen in forum C Programming
    Replies: 17
    Last Post: 04-14-2008, 11:50 PM
  3. New program, guidence
    By RoD in forum C++ Programming
    Replies: 5
    Last Post: 12-06-2002, 06:36 AM
  4. Homework guidence, very important
    By RoD in forum C++ Programming
    Replies: 4
    Last Post: 12-04-2002, 07:28 PM
  5. Need some Guidence
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 10-19-2001, 08:30 AM