I have been trying to get getch
to work in another program with no success. So I have made the most basic program I can using getch
the way I want it to work in the main program.
I have researched the need for noecho
, cbreak
, initscr
and nodelay
, I have also tried using newscr()
but to no success.
The problem I am having is that the chars aren't being printed to the screen till I hit "enter", when they should be put
to the screen every loop. Why is this happening? Also the cursor doesn't return to the left of the screen at the new line. eg.
abc
def
ghi
I have looked for the answer but am stumped again...
#include <stdio.h>
#include <ncurses.h>
int main()
{
initscr();cbreak(); noecho();nodelay(stdscr,0);
char c ;
while((c=getch())!=EOF){
putchar(c);}
return 0;
}