Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>getpass() read a password</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getpass()               Read a Password

 #include   <conio.h>

 char       *getpass(prompt);
 const char *prompt;                     Prompt for password

    getpass() writes 'prompt' to the console and then reads a password
    from the keyboard.  The keys pressed are not echoed to the console.

       Returns:     A pointer to the password, which is a null-terminated
                    string of up to eight characters.  The password is
                    stored in a static string that is overwritten by
                    successive calls to getpass().

   -------------------------------- Example ---------------------------------
    The following statements prompt the user for a password, and then a
    second time to verify that it was entered correctly.

           #include <stdio.h>   /* for printf */
           #include <conio.h>   /* for getpass */

           main()
           {
               char password[9];

               strcpy(password,getpass("Enter password: "));
               printf("\n");
               if (strcmp(password,getpass("Enter password again: ")) != 0)
                   printf("passwords do not agree\n");
               else
                   printf("password OK\n");
           }



Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson