FBB::Tty(3bobcat) | Controls echoing of characters | FBB::Tty(3bobcat) |
FBB::Tty - Controls echoing of characters entered at the terminal
#include <bobcat/tty>
Linking option: -lbobcat
Tty(3bobcat) objects can be used to control the echoing of characters entered at the terminal (usually at /dev/tty). Directly reading from /dev/tty allows programs to read information (e.g., passwords or pass phrases) even if the standard input stream is redirected to a file. Unless redirected, std::cin is connected to /dev/tty.
Tty(3bobcat) objects may be used as stand-alone objects or (usually anonymous) Tty(3bobcat) objects may be inserted into or extracted from streams. When inserting or extracting objects the involved streams are not affected; only the echoing of characters entered at /dev/tty is manipulated.
Tty(3bobcat)’s destructor does not reset the echo-state of /dev/tty to its original value. If that is required a Tty(3bobcat) object must be created first, calling its echo(Tty::RESET) member at the appropriate time.
FBB
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace FBB.
-
The enum EchoType requests the type of echo-handling:
#include <iostream> #include <string> #include <bobcat/tty> using namespace std; using namespace FBB; int main() {
cout << "Enter some text (not echoed): " << Tty(Tty::OFF);
string line;
getline(cin, line);
cout << "\n"
"You entered: `" << line << "’\n";
cout << "Enter some text (echoed): ";
getline(cin >> Tty(Tty::ON), line);
cout << "You entered: `" << line << "’\n"; }
bobcat/tty - defines the class interface
None Reported.
Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’.
This is free software, distributed under the terms of the GNU General Public License (GPL).
Frank B. Brokken (f.b.brokken@rug.nl).
2005-2018 | libbobcat-dev_4.08.06-x.tar.gz |