title: function call with curses.h
body: <p>It's first time that I use curses.h. I have posted my code above. I need to make some function call when right or left arrow is pressed. when I add draw function call to my code, it does not draw when arrow key is pressed, but it draws when program terminates, after user pressing 'q'. Any ideas?   </p>
  
  <pre><code>int main(int argc, char * argv[] )
      {
        setup_curses();  
        c = getch();
  
  
        while(1)
        {   
          if (c != ERR)
          {
            move(5,0);
            printw("left arrow key rotates counter-clockwise, right clockwise, space for thrust, q to quit.");
            if (c == KEY_LEFT)
              draw();
            else if (c == KEY_RIGHT) 
              draw();
            else if (c == ' ')
              printw("do something");
            else if (c == 'q')
              break;
            refresh();
  
          }
  
          c = getch();
  
        }
  
  
  
      unset_curses();
      exit(EXIT_SUCCESS);
      }
  
  
          void setup_curses()
          {
            initscr();
            cbreak();
            noecho();
            keypad(stdscr, true);
          }
  
          void unset_curses()
          {
            keypad(stdscr, false);
            nodelay(stdscr, false);
            nocbreak();
            echo();
            endwin();
          }
  </code></pre>