PDA

View Full Version : Looking to NOT echo input when writing to stdin



ultim8
19th June 2009, 22:15
...Similar to getpass found on *nix...

Basically I'm prompting for a password on the commandline and I would like the user to type the password in with out it actually echoing back to the console.

Does anyone have any ideas that is crossplatform compatible(win/mac/linux)? Preferably using QT libs (I really don't want to have to link against anything else if I don't need to).

wysota
19th June 2009, 22:57
I'm afraid you have to directly access the terminal (i.e. using the readline library) to be able to do that. Qt can't get its hands on the console input until you press enter. I don't think you will find a portable solution to the problem.