I have a program that scans on user input with i=getchar(); and it works. To prevent that the user has to press Enter every time i used that:
tcgetattr(STDIN_FILENO,&old_tio);
new_tio=old_tio;
new_tio.c_lflag &=(~ICANON & ~ECHO);
tcsetattr(STDIN_FILENO,TCSANOW,&new_tio);
And i reset with:
tcsetattr(STDIN_FILENO,TCSANOW,&old_tio);
After that the user has to type something. I used this for it:
string userinput;
cin >> userinput;
But the console doesn't show the typed text (while typing). I tried to reenable local echo manually with this:
tcsetattr(STDIN_FILENO,TCSANOW,&old_tio);
old_tio.c_lflag |= ECHO;
But the console still doesn't show the local echo It's 10pm and i'm very sleepy so my question may be very easy to answer