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
2010-07-18 17:43:30
If you're going to downvote - please explain why
Jamie Wong
2010-07-18 18:09:08
Agreed, the downvote is unjustified - curses actually provides a `getch()` function.
caf
2010-07-19 00:27:07
+2
A:
If echoing to the screen is not a problem, you could try using getchar()
from stdio.h
.
Carl Smotricz
2010-07-18 17:44:43
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
2010-07-18 19:36:22