I\'m programming in C using ncurses libraries (it\'s the first time) and I\'ve two problems. I\'m on ubuntu with the default terminal (gnome terminal).
1) I need to
POSIX does not cover this case, because the curses document is not part of POSIX. The Open Group happens to maintain documentation for both:
SIGWINCH
is absent)As noted in the manual page for resizeterm, you should not call that function from within a signal handler, because it calls "unsafe" functions. The topic of "unsafe" functions is discussed in several places; that in gcc's documentation would do for a start.
Regarding documentation, @larsmans appears to be quoting from scroll(3), but not citing comparable links for ncurses and "POSIX". For what it's worth:
Back to OP's question:
resizeterm
nor of resize_term
. It is not stated, but presumably OP resized the terminal window and the program did not respond. The manual page for resizeterm
is clear enough that ncurses does not cause the terminal to resize. For that (on some terminals), one can use the -s
option of resize (a utility program for xterm). If successful, that resizes the terminal, which in turn sends a SIGWINCH
.
ncurses has a predefined signal handler for that, but at the application level, handling KEY_RESIZE
is the recommended way. There are several programs in ncurses-examples which do this.