Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.88 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. printing data at a array location directly after receiving the two digit address using cbreak(); <curses.h> and getch();
  2. int northsouth[2]; //array to hold input
  3.    int nschoice; //counter for for below
  4.  
  5.    int loopOn = 1;
  6.    int northSave;   //(confused me) places to save value of northSouth[] in attempt  
  7.    int southSave;   //to print only after receiving two digits.
  8.  
  9.    while(loopOn != 0)
  10.    {        
  11.          for(nschoice = 0; nschoice < 2; ++nschoice)
  12.          {
  13.             northsouth[nschoice] = getch();
  14.             if(nschoice == 1 && northsouth[0] != northSave && northsouth[1] != southSave)
  15.             {
  16.  
  17.  
  18.                strcat(input, l[northsouth[0] -= 48][northsouth[1] -= 48]);  
  19.                printf("33[2J33[1;1H");
  20.                printf("%s", input);
  21.                northSave = northsouth[0];
  22.                southSave = northsouth[1];
  23.              }
  24.  
  25.          }
  26.  
  27.    }