QNX Developer Support
Prompt for and read a password
#include <unistd.h> char *getpass( const char *prompt );
- The string you want to display to prompt for the password.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
|This function is in libc.a, but not in libc.so (in order to save space).|
The getpass() function can be used to get a password. It opens the current terminal, displays the given prompt, suppresses echoing, reads up to 32 characters into a static buffer, and restores echoing. This function adds a null character to the end of the string, but ignores additional characters and the newline character.
A pointer to the static buffer.
This function leaves its result in an internal static buffer and returns a pointer to it. Subsequent calls to getpass() modify the same buffer. The calling process should zero the password as soon as possible to avoid leaving the clear-text password visible in the process's address space.