I'm trying to create a very simple chat application where a user types something in (received by cin) and I echo their output manually, but cin naturally prints to console after the user hits enter on the keyboard.
Is there a way to suppress this echo back into cout after the user returns from cin so I can override it with my own message?
Ex:
int main()
{
string str;
while(true)
{
getline(cin, str)
cout << "Person: " << str << endl;
}
}
The output looks like this:
Some text I typed
Person: Some text I typed
The first line is automatically echoed back into the terminal when the user sends the new line. This is the line I would like to suppress.
Any ideas? I am trying to stay away from using any 3rd person library if possible.