Over a million developers have joined DZone.

Ncurses

·

#include 

int main() {

   int c;
   WINDOW *config_win;

   initscr();
   cbreak();
   noecho();

   config_win = newwin(10,20,1,1);
   mvwaddstr(config_win, 1,1, "test");

   while (c = wgetch(config_win)) {
      switch(c) {
         case 'a':
         delwin(config_win);
         config_win = newwin(10,20,1,1);
         mvwaddstr(config_win, 1,1, "print this");
         wrefresh(config_win);
         break;

         default:
         delwin(config_win);
         config_win = newwin(10,20,1,1);
         mvwaddstr(config_win, 1,1, "hello");
         wrefresh(config_win);
         break;
      }
   }

   endwin();
}

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}