Hide input string from stdin
Nemanja Boric via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 23 09:00:40 PDT 2016
On Monday, 23 May 2016 at 15:56:14 UTC, Wyatt wrote:
> On Sunday, 22 May 2016 at 22:38:46 UTC, Michael Chen wrote:
>> I tried to write a small program that receive string as
>> password.
>> However, I didn't find available library for hide input
>> string, even in core library. Any suggestion?
>
> For Linux, I think you could just use getpass() from
> core.sys.posix.unistd. Not sure what the Windows equivalent
> is. An agnostic, user-facing version isn't a terrible idea.
> Or arguably better, a good way to disable echo on stdin; maybe
> file a bug about this against std.stdio?
>
> -Wyatt
Here's example `getpass` (in C++, but can be translated
trivially) for Windows, using `SetConsoleMode` with turning off
`ENABLE_ECHO_OUTPUT`.
http://www.cplusplus.com/articles/E6vU7k9E/#WIN-e1
More information about the Digitalmars-d
mailing list