equivalent to getch(), mac/linux crash
Posted
by
acidzombie24
on Stack Overflow
See other posts from Stack Overflow
or by acidzombie24
Published on 2008-11-06T00:16:52Z
Indexed on
2013/06/27
22:22 UTC
Read the original article
Hit count: 100
Hey guys. So I am using getch() and my app crashes instantly. Including when doing:
int main()
{
getch();
}
I can't find the link but supposedly the problem is, it needs to turn off buffering or something strange along those lines and I still want cout to work along with cross platform code.
I was told to use std::cin.get(), but I'd like the app to quit when a key is pressed, not when the user typed in a letter or number then press enter to quit.
Is there any function for this? The code must work under Mac (my os) and Windows.
© Stack Overflow or respective owner