<p>I am using <code>getch()</code> and my app crashes instantly. Including when doing:</p>

<pre><code>int main()
{
    getch();
}
</code></pre>

<p>I can't find the link but supposedly the problem is that it needs to turn off buffering or something strange along those lines, and I still want <code>cout</code> to work along with cross platform code.</p>

<p>I was told to use <code>std::cin.get()</code>, 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.</p>

<p>Is there any function for this? The code must work under Mac (my os) and Windows.</p>

<hr>

<p>Linking/compiling is not an <a href="https://stackoverflow.com/questions/267250/equivalent-to-getch-mac-linux-crash#comment14636199_267281">issue</a>; I include <code>&lt;curses.h&gt;</code> and link with <code>-lcurses</code> in XCode, while Windows uses <code>&lt;conio.h&gt;</code>.</p>

You have not exhibited a
```
```
#include <stdio.h>
```
```
or
```
```
#include <curses.h>
```
```
or similar line. Are you sure that you are linking against a library that
includes
```
getch()
```
?