Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
getpass - read string of characters without echo
&pagelevel(4)&pagelevel
Syntax | #include <unistd.h> char *getpass(const char *prompt); |
Description | getpass() performs the following actions. It
opens the process ́ controlling terminal, writes the null-terminated string prompt to that device, disables echoing, reads a string of characters up to the next newline character or EOF, restores the terminal state, and closes the special file for the terminal.
|
Return val. | Next option character from the command line |
|
| upon successful completion. The return value consists of at most {PASS_MAX} bytes that were read from the terminal device.. |
| Null pointer | if an error occurs. The original state of the terminal is restored, and errno is set to indicate the error. |
Errors | getpass() will fail if:
|
| EINTR
| getpass() was interrupted by a signal.
|
| EIO
| The process is a member of a background process attempting to read from its controlling terminal; the process is ignoring or blocking the SIGTTIN signal or the process group is orphaned. |
| EMFILE
| {OPEN_MAX} file descriptors are currently open in the calling process.
|
| ENFILE
| The maximum allowable number of files is currently open in the system. |
| ENXIO
| The process does not have a controlling terminal. |
Notes | The return value points to static data whose content may be overwritten by each call. pclose() is executed only for POSIX files.
getpass() is not thread-safe. Will no longer be supported by the X/Open-Standard in future.
|
See also | limits.h , unistd.h .
|