Search code examples
c++linuxinputiouser-input

How to hide my input on my terminal?


I'm on Ubuntu with C++

Image

How do I hide the red box (user input) as shown in the image above on my terminal ?

char *MESSAGE=getpass(""); 

the code above would leave a blank line after each input and I dont want the message to be hidden while the user typing the message.

In short, I want the message to be visible as I'm typing the message but goes invisible on my terminal as soon as he entered.

EDIT : Can someone please enlighten me on how this question is duplicated to that thread?.


Solution

  • You could clear the terminal after a message has been sent and reprint the whole chat afterwards.