I am having a similar problem to Ncurses No Output.
Just I am having a getch call before exiting.
I don't see any output when I don't add a second getch call
before outputting anything. The following is a collection of
all relevant code parts copied together in one routine
exhibiting the same problem as my complete program.
So some calls look superfluous but I find those necessary
in the local context.
#include <glib.h>
#include <stdlib.h>
#define bool ncbool
#include <ncurses.h>
#undef bool
gint32 main ( gint32 argc, gchar * argv [] )
{
initscr ();
keypad ( stdscr, FALSE );
nonl ();
cbreak ();
nodelay ( stdscr, FALSE );
noecho ();
/*
gint zch_extra;
zch_extra = getch ();
*/
WINDOW* w;
w = newwin ( 5, 10, 3, 3 );
box ( w, 0, 0 );
wnoutrefresh ( w );
mvwaddstr ( w, 1, 1, "huhu" );
wnoutrefresh ( w );
doupdate ();
mvwaddstr ( w, 2, 1, "<cont>" );
wrefresh ( w );
gint zch;
zch = getch ();
clear ();
refresh ();
nl ();
nocbreak ();
echo ();
endwin ();
return 1;
}
I only see output when I add the extra getch commented out in the code.
Compilation commands:
gcc -I /usr/include/ncurses -I /home/mkiever/include -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -ansi -ggdb -c -o main.o main.c
gcc -o test main.o -lncurses `pkg-config --libs glib-2.0`
Platform (uname -a): Linux Pirx 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) i686 GNU/Linux
What am I doing wrong? I guess, it's my combination of different refresh calls, but I don't have a clue where exactly the problem is.
Thanks for taking a look.
mainreturnsint, and the argumentargcis aninttoo; usinggint32instead can never be "more correct" - Antti Haapala