For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > October 2004 > ncurrses window and keypad









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ncurrses window and keypad
subflood

2004-10-30, 3:56 pm

In my main function I first declare a few variables and I then call
these functions:

initscr();
noecho();
cbreak();
keypad(stdscr, TRUE);
refresh();

I then draw a few horizontal and vertical lines on the "standard
screen".

Next I make a window:

new_win = newwin(5, 5, 20, 15);
box(new_win, 0, 0);
wrefresh(new_win);

Infinite loop and switch

while (1) {

ch = getch();

printw("1");

switch(ch) {

case KEY_LEFT: ....
.....

It compiles without any problems. When I execute it draws the vertical
and horizontal lines and displays the window. As soon as I press the
left arrow key I get: Segmentation fault

It never prints the 1.
Thomas Dickey

2004-10-31, 8:56 pm

subflood <PawelB.lnx@gmail.com> wrote:
> In my main function I first declare a few variables and I then call
> these functions:


you left something out, but there's not enough information to guess what.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com