home *** CD-ROM | disk | FTP | other *** search
/ ftp.muug.mb.ca / 2014.06.ftp.muug.mb.ca.tar / ftp.muug.mb.ca / pub / src / linux / old-src / ncurses-1.8.5 / copy.c < prev    next >
C/C++ Source or Header  |  1993-11-27  |  678b  |  40 lines

  1. #include <curses.h>
  2.  
  3. main()
  4. {
  5. WINDOW *win1, *win2;
  6. int h, i;
  7.  
  8.     initscr();
  9.     cbreak();
  10.     noecho();
  11.     win1 = newwin(20, 50, 10, 20);
  12.     for (h = 0; h < 20; h++)
  13.         for (i = 0; i < 50; i++)
  14.             mvwaddch(win1, h, i, 'X');
  15.     wrefresh(win1);
  16.     getch();
  17.  
  18.     win2 = newwin(20, 50, 15, 30);
  19.     for (h = 0; h < 20; h++)
  20.         for (i = 0; i < 50; i++)
  21.             mvwaddch(win2, h, i, 'Y');
  22.     wnoutrefresh(win1);
  23.     wnoutrefresh(win2);
  24.     doupdate();
  25.     getch();
  26.  
  27.     /* now, remove window 2 and restore the contents of window 1 */
  28.     i = copywin(win1, win2, 5, 10, 0, 0, 14, 39, 0);   
  29.     wnoutrefresh(win1);
  30.     wnoutrefresh(win2);
  31.     printw("copywin returns %d\n", i);
  32.     wnoutrefresh(stdscr);
  33.     doupdate();
  34.  
  35.     getch();
  36.  
  37.     endwin();
  38. }
  39.  
  40.