Table of Contents

getpass

char *getpass(const char *ptr);

description of getpass

reads a password

getpass reads a password from the system console, after the user is prompted for a password to a null-terminated string and display the password has been disabled. A pointer to a null-terminated string of up to eight characters (not counting null terminator) is returned.

#include <conio.h>
 
int main( void )
{
    char *password;
 
    password = getpass("type in your password: ");
    cprintf("Password: %s\n", password);
    return 0;
}

output of getpass c example

  type in your password: superpass
  Password: superpass