Attachment 'Window.c'

Download

   1 #include <ncurses.h>
   2 
   3 #define DX 3
   4 #define ONLELINE 3
   5 #define MAXSTR 80
   6 
   7 void main() {
   8 	WINDOW *winA, *winB, *winO;
   9 	char inA[MAXSTR], inB[MAXSTR];
  10 	int c = 0;
  11 	int half;
  12 
  13 	initscr();
  14 	cbreak();
  15 	printw("Input:");
  16 	refresh();
  17 
  18 	half = (COLS-2*DX)/2;
  19 	winA = newwin(ONLELINE, half, DX, DX);
  20 	winB = newwin(ONLELINE, half, DX, DX+half);
  21 	winO = newwin(LINES-ONLELINE-DX*2, (COLS-2*DX), DX+ONLELINE, DX);
  22 	keypad(winA, TRUE);
  23 	keypad(winB, TRUE);
  24 	scrollok (winO, TRUE);
  25 	wmove(winO, 1, 0);
  26 	do {
  27 		werase(winA); box(winA, 0, 0);
  28 		mvwgetnstr(winA, 1, 1, inA, MAXSTR);
  29 		werase(winB); box(winB, 0, 0);
  30 		mvwgetnstr(winB, 1, 1, inB, MAXSTR);
  31 		wprintw(winO, "  Entered: %s %s\n", inA, inB);
  32 		box(winO, 0, 0);
  33 		wrefresh(winO);
  34 	} while(*inA);
  35 
  36 	endwin();
  37 
  38 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.