How does one display * when typing a password in a C/C++ command-line tool? [duplicate]

寵の児 提交于 2019-12-11 03:27:56

问题


Possible Duplicate:
Read a password from std::cin
Replace input with “ * ” C++

I'm looking for the C/C++ comparable way of doing <input type="password" /> for allowing the user to type in their password after a prompt in a command-line tool written in C.

string username;
string password;
cout << "Username: ";
getline(cin, username);
cout << "Password: ";
    [<input type="password" />]
getline(cin, password);

来源:https://stackoverflow.com/questions/13691249/how-does-one-display-when-typing-a-password-in-a-c-c-command-line-tool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!