Middleware, development tools, realtime operating system
software and services for superior embedded design


Home
QNX Community Resources
Developer Support
QNX Documentation Library
QNX Developer Support

QNX Developer Support

QNX Software Systems
Developer Resources
Blogs
Board support packages
Foundry27 projects
Forums
Hardware support listing
Online video tutorials
Product documentation
Technical Articles

[Previous] [Contents] [Index] [Next]

getpass()

Prompt for and read a password

Synopsis:

#include <unistd.h>

char *getpass( const char *prompt );

Arguments:

prompt
The string you want to display to prompt for the password.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.


Note: This function is in libc.a, but not in libc.so (in order to save space).

Description:

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.

Returns:

A pointer to the static buffer.

Classification:

Legacy Unix

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread No

Caveats:

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.

See also:

crypt()


[Previous] [Contents] [Index] [Next]