newbie question

M.A-R. Abdullah mara2@hermes.cam.ac.uk
Thu Feb 7 16:47:00 GMT 2002


Hi
I'mhaving problems trying to use getch(). In short, what is the simplest
way to use this. I have the following code but the problem is that the
screen is cleared when getch() is called. How can this be resolved?
(I am typing the program in, please excuse spelling errors, the original
does compile)


#include <stdio.h>
#include<curses.h>

int main(void)
{
  int i;
  WINDOW *win=NULL;

  win=initscr();

  cbreak();
  i=nodelay(win, 0);

  printf("This statement doesn't seem to get printed");

  i=getch();
  printf("This char is %c\n\r", i);
  printf("This statement is printed");

  endwin();
  return 0;
}

Thanks

MA



More information about the Gcc-help mailing list