TL;DR part:
Okay so I came across this problem while trying to make a sort of piano simulator like thing using only the STL and on console.
I used _getch() because that's the only input option that immediately takes input (you can't expect a piano player to press the enter key after he has selected his key now, can you?).
Problem now is though, that while the key note is being played for say like half a second or whatever, the player can still fill the input buffer with keys so that the program will play those keys even when the user's hands are off the keyboard. And that's not very neat.
-> So I need a way to make it so that everything before the key note being played if flushed off.
Now for the requirement:
I need something that can either flush the input buffer without needing a '\n' (there are lot of ways to flush with '\n', but we won't have a '\n' at all because our user does not use the enter key)
Or alternatively I need something that could temporarily disable and re-enable input if that's even possible. But remember I can only work with the STL (I would still like to know if it's possible using some library, though).