I am programming in C using the ncurses libraries (this is the first time), and I have two problems. I am on ubuntu with the default terminal (gnome terminal).
1) I need to change the size of the terminal. I used resizeter () and resize_term (), but they fail.
2) I use the scrollok () function, and the problem is that I lose the scroll lines (when I return using wscrl (), there are empty lines).
#include <ncurses.h> int main() { WINDOW *win, *win2; int i; char c; initscr(); cbreak(); noecho(); win=newwin(8,20,1,1); box(win,0,0); win2=newwin(6,18,2,2); scrollok(win2,1); wrefresh(win); wrefresh(win); for(i=0;i<15;i++){ c=wgetch(win2); if(c=='u'){ wscrl(win2,-1); wrefresh(win2); } else{ wprintw(win2,"%c\n",c); wrefresh(win2); } } delwin(win); delwin(win2); endwin(); return 0; }
source share