-
ncurses window problem
I encountered a problem while I read about using "windows" with ncurses library. When I tried to create a simple program using windows, it compiled well without any warnings, but window's borders don't show up in console. In some point I did something that made them flash (right now I don't have any idea about what I did), but after flashing once, they went away right away. I've tried to refresh it. Example programs in this tutorial don't work.
If someone wants, here's a simple example program.
Code:
#include <ncurses.h>
int main(void) {
WINDOW *wp;
initscr();
wp = newwin(10, 10, 10, 10);
box(wp, 0, 0);
wprintw(wp, "foo");
wrefresh(wp);
endwin();
return 0;
}
My OS is Gentoo Linux 2007.0. I'm using bash-3.1 and I've tried in ash-1.6. Compiler is gcc 4.1.1 and linker GNU ld-2.17. I have latest version of ncurses library. If someone needs more information, I can tell it.
-
Well, there's nothing in your program that prevents it from exiting as soon as it's finished showing the window... So I expect it will flash up a window for brief moment and then take it down again.
Try putting a "getchar()" before your return in main().
--
Mats
-
Sorry, forgot it from that program. I've used it, but it doesn't work.
And a littele more specifing, I _can_ see text written in window, but I _can't_ see windows borders.
-
Okay. Got it working. First I noticed, that if I put getch(); after calling box() in function that I made to create windows and put frames in it, it showed borders. After that I noticed, that if I replaced that getch(); with refresh();, same thing happened and I didn't have to press any key.
Looks like this problem is pretty much solved.