Alternative to conio.h?

Does anyone kow a getch() function for linux not in conio.h?
Or any alternative? Please!
Use NCurses.

sudo apt-get install ncurses-dev

(or whatever your equivalent) to make sure you have everything for development with the NCurses library (including the ncurses shared library and terminfo database runtime stuff)

See also here
http://www.cplusplus.com/forum/beginner/4520/page1.html#msg19965

Hope this helps.
BIG BIG Thanks!
I tried to use ncurses before but i never thought about functions required to use it.
Oops...
I didn't tried the code and there something wrong:
when i try to use getch i get an error: invalid conversion from int(*)() to char.
I tried to change char to int and long but alway i get error and i have no idea what to do.
Er, I goofed twice on that example. It is fixed now.

Unfortunately, the curses library was written with a lot of its functions prototyped to take char*, when they should really take const char*, so you have to cast to keep the compiler happy when sending in string literals. (That, or tell your compiler to make string literals writeable, which I don't recommend.)

What line is complaining about the "int(*)() to char"?
You most likely have something like
int x = getch;
when it should be
int x = getch();
Nice catch! I forgot about that! :-)
Topic archived. No new replies allowed.