ncurses problems
From: Materialised (materialised_at_privacy.net)
Date: 03/01/04
- Next message: Jo: "Re: Timeout for connect()"
- Previous message: Joerg Schilling: "Re: CD TOC?"
- Next in thread: Materialised: "Re: ncurses problems"
- Reply: Materialised: "Re: ncurses problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 01 Mar 2004 17:36:13 +0000
Hi every one
I am writing a program, that will create a window, with a subwindow
inside of it.
The layout will hopefully look something like this
---------------------------------
| |
| |
| |
| Window 1 |
| |
| |
| |
---------------------------------
| |
| Sub Window |
---------------------------------
I am using the follwing code...
int main (void)
{
WINDOW *win1, *win2, *win3;
int lines, cols;
initscr();
if(has_colors())
start_color();
getmaxyx(stdscr, lines, cols);
win1 = newwin(lines, cols, 0, 0);
win2 = subwin(win1, 1, cols, lines -2, 0 );
box(win2, ACS_VLINE, ACS_HLINE);
init_pair(1,COLOR_WHITE,COLOR_BLACK);
init_pair(2,COLOR_WHITE, COLOR_RED);
init_pair(3,COLOR_YELLOW, COLOR_GREEN);
attrset(COLOR_PAIR(1) | A_BOLD);
wattrset(win1, COLOR_PAIR(2));
wattrset(win2, COLOR_PAIR(3));
wrefresh(win1);
touchwin(win1);
wrefresh(win2);
mvwprintw(win2, 1, 0, "Test");
wrefresh(win1);
touchwin(win1);
wrefresh(win2);
endwin();//end of curses
exit(EXIT_SUCCESS);
}
My problem is with the line
win2 = subwin(win1, 1, cols, lines -2, 0 );
If i change the second argument to anything other than 1, my program
core dumps, and I dont understand why because subwin is prototyped as
WINDOW *subwin(WINDOW *orig, int nlines, int ncols,
int begin_y, int begin_x);
according to the man pages.
Also the line
mvwprintw(win2, 1, 0, "Test");
Doesnt print, for some reason which I dont understand.
I hope someone can point out where I am going wrong.
Thanks in advance
-- Materialised
- Next message: Jo: "Re: Timeout for connect()"
- Previous message: Joerg Schilling: "Re: CD TOC?"
- Next in thread: Materialised: "Re: ncurses problems"
- Reply: Materialised: "Re: ncurses problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|