Hello every one,
i have written the following program for testing getch function behaviour.
but, as soon as i run the program i am getting segmentation fault.
i dont understand the problem.
i am using GCC compiler on Linux Environment.
i want to test the key scan program.
#include<ncurses.h>
int main()
{
char ch;
ch=getch();
printf("%c",ch);
return 0;
}
running: ./a.out -lncurses
i have read the manual page of getch, where it is written that
The getch, wgetch, mvgetch and mvwgetch, routines read a character from the window. In no-delay mode, if no input is waiting, the value ERR is returned. In delay mode, the program waits until the system passes text through to the program. Depending on the setting of cbreak, this is after one character (cbreak mode), or after the first newline (nocbreak mode). In half-delay mode, the program waits until a character is typed or the specified timeout has been reached.
1.
The getch, wgetch, mvgetch and mvwgetch, routines read a character from the window.
can't i use getch to get a character from the keyboard.
please, some one give me a small example program on how to use
getch.
Thanks In Advance