I am writing a Linux CLI program. I need to get a password from the user and, obviously, I don't want the password to be echoed to the console.
There are several solutions available here, but they are all for plain C.
C command-line password input
How to mask password in c?
Getting a password in C without using getpass (3)?
How can those be adapted for C++, using std::string instead of char[]?
What would be the most elegant C++ solution?
Linux itself is written (mostly) in C, so anything you could find in C++ would only be an abstraction around a single C routine. Better to call the routine yourself, converting the input and result.
Use any of the plain C solutions: