Using cin in a program with ReadConsoleInput() ...
I am trying to develop an interactive menu service, which will be able to read text and mouse clicks on buttons etc and keys together. My best bet was to use ReadConsoleInput() and handle each event in switch cases, which I am able to implement perfectly. But I now wished to perform a cin operation after my reading is complete. So I tried to implement the following 'escape' code: https://code.sololearn.com/cTVbrMO8S01G/#cpp But the problem I face is that cin reads nothing. I am able to type the characters, but they are never assigned to the string. It remains empty. So, how do I restore the reading ability to cin? I tried to make another approach, by marking some flag variable true, when I wish to exit, and appending each new character I type on screen to the string and print it at the position I am supposed to type it. I also implemented a backspace function like this by handling VK_BACK. But that becomes way too lengthy. I wished to have something easier like cin. Please help me reuse cin. Also, Is there another way I can exit from the infinite loop without using goto (a deprecated approach) ? I tried using break, but that just brings me out of the switch case.