#include <stdlib.h> int getlongpass(const char *prompt, char *password, int max_length)
This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
from the standard input, without an echo, after prompting with a
null-terminated string prompt. It puts a null-terminated string of
at most max_length - 1 first characters typed by the user into a
buffer pointed to by password. Pressing Ctrl-C or Ctrl-Break will
cause the calling program to exit(1)
.
Zero if successful, -1 on error (and errno is set to an appropriate value).
not ANSI, not POSIX
char password[MAX_PASS]; (void)getlongpass("Password: ", password, MAX_PASS);
Go to the first, previous, next, last section, table of contents.