Is NetBeans passing keystroke to my ncurses application?

  • From: "hyperchondriac" < >
  • To:
  • Subject: Is NetBeans passing keystroke to my ncurses application?
  • Date: Sun, 23 Sep 2012 09:21:11 -0400

Hi Everyone,

I'm getting started using ncurses with NetBeans (Windows 7 and Cygwin for g++ 
and ncurses), and I'm following the tutorial here 
(http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/). I'm trying to write 
the first program in the tutorial (simple I/O) but I'm getting problems. A 
minimal example is (adapted from here 
(http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/init.html)):


Code:

#include "ncurses.h"

int main(int argc, char** argv) {

    int ch;

    initscr();
    raw();
    keypad(stdscr, TRUE);
    noecho();

    printw("Type any key to see it repeated:\n");
    ch = getch();
    printw("The pressed key is ");
    printw("%c", ch);
    printw(". It has a key code of: ");
    printw("%d", ch);
    refresh();
    getch();
    endwin();

    return 0;
}




It all compiles fine, and happily prints out the â€œType any key...” line. 
However, if I leave it for about a second it carries straight on, with the 
following output:


Code:

Type any key to see it repeated:
The pressed key is ~Z. It has a key code of: 410




I've looked up the keycode 410 and it's come up with this 
(http://www.codetable.net/decimal/410). I know I'm certainly not typing it in!

When I write and compile it directly with g++ in Cygwin it all works great. 
So it looks like something (from NetBeans?) is passing a key stroke through 
to the program without my input. Is this an option in the compiler that I 
need to turn off?

Thanks a lot for your help in advance.






Is NetBeans passing keystroke to my ncurses application?

hyperchondriac 09/23/2012

Is NetBeans passing keystroke to my ncurses application?

ThomasDickey 09/23/2012

Is NetBeans passing keystroke to my ncurses application?

hyperchondriac 09/23/2012

Project Features

About this Project

CND was started in November 2009, is owned by DimaZh, and has 142 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150226.965aeb8). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close