[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
[LI] ncurses cursed problem
Gentlemen,
I wrote a small snippet of a program using ncurses, and it dumps core
when executing. gdb says the problem is in "wattrset (win, A_NORMAL);".
I could'nt make out what went wrong. Can sombody help ? My code is
#include <ncurses.h>
int
main (){
int x,y,i,j;
int height=20, width =60;
WINDOW *win;
x= (COLS - width)/2;
y= (LINES - height)/2;
win= newwin( height, width, y, x);
initscr();
keypad (win,TRUE);
cbreak();
wattrset (win, A_REVERSE);
for (i=0; i<height; i++){
wmove( win, y+i, x);
for (j=0; j<width; j++){
if ( (!i && !j) || (i == width-1 && !j) || (!i && j == height -1)
|| (i == height - 1 && j == width - 1))
waddch (win, A_NORMAL | ACS_ULCORNER);
else if ((!i) || (!j))
waddch (win, A_NORMAL | ACS_HLINE);
else if ( (!j) || (j == width - 1))
waddch (win, A_NORMAL | ACS_VLINE);
else
waddch (win, A_NORMAL | ' ');
}
}
wattrset(win, A_NORMAL);
delwin(win);
nocbreak();
endwin();
return 0;
}
Again, which is better package, ncurser or slang. I donot know much about
slang lib.
Thanks everybody
Vasudevan K.S
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available. Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.