-
Using getch()
I am familiar with using getch() in a windows C compiler, but am having trouble while using it in gcc. I am attempting to use it to have my program wait for an enter keystroke, this is very easy to do in windows, all I need to do is include conio.h and add getch() to my code. In linux I did a 'man getch' and read that I must instead include curses.h, which I did. If I use getch() in my linux code I get quite a few errors. What can I use to have my program wait until it gets an enter keystroke?
-
What errors do you get?
Compile errors (don't forget to include the curses library) or runtime errors?
-
How did you compile, did you include the curses library while compiling? Like:
cc main.c -o main -lcurses
Just including curses.h is not going to help you at all, you also need to link with the appropriate library, which in your case is the 'curses'.