tags:

views:

227

answers:

3

In turbo c++, we can use getch() function available in conio.h. But in linux, gcc compiler doesn't provide conio.h header file, then how to get functionality of getch() function?

+8  A: 

Check out curses:

http://en.wikipedia.org/wiki/Curses_%28programming_library%29

Jamie Wong
If you're going to downvote - please explain why
Jamie Wong
Agreed, the downvote is unjustified - curses actually provides a `getch()` function.
caf
+1  A: 

getch() seems to be included in curses library.

che
+2  A: 

If echoing to the screen is not a problem, you could try using getchar() from stdio.h.

Carl Smotricz
Echoing to the screen is not the only difference between `getch()` and `getchar()`. `getch()` doesn't wait for a carriage return before being reading from the buffer. E.g. to input 'a' using `getchar()`, you have to type `a[ENTER]`. With `getch()`, you only need type 'a'.
Jamie Wong