Open main menu

CDOT Wiki β

Team 5 Bugs Report

Revision as of 14:40, 26 September 2013 by Tai Nguyen (talk | contribs) (Week 4-5 Log (Sept. 25/13):)
  • On local machine (Windows), while compiling with GCC,
   ncursor.h : No such file or directory

(GNU library not existing on Windows platform by default)

  • String Overlapping during strncpy() causing memory corruption.
     if ((int)strlen(str)>fieldLen){
       char * strOut;
       //strOut = new char[fieldLen + 1];
       strncpy(strOut, str, fieldLen);
       strOut[fieldLen]='\0';
       
       //delete [] strOut;
      }

( Commented being the fix)


Week 4-5 Log (Sept. 25/13):

- display function completed, no bugs found - edit function problem

 objective: move cursor left and right with arrow keys (LEFT, RIGHT)
 code attempt: 
 do{
  console.getPosition(currPos[0], currPos[1]); //currPos[0] - rows
  console >> key;


 do{      
  console.getPosition(currPos[0], currPos[1]);
  console >> key;
 if(key >= ' ' && key <= '~'){
  console << key;
 }else if(key == LEFT){
  console.setPosition(currPos[0], currPos[1] - 1);
 }else if(key == RIGHT){
  console.setPosition(currPos[0], currPos[1] + 1);
 } 
}while(key != ESCAPE);
issue: when typing, cannot insert correct values and cannot use left and right keys
However if re-written as, it performs as desired:
do{      
 console >> key;
 if(key >= ' ' && key <= '~'){
  console << key;
 }else if(key == LEFT){
  console.getPosition(currPos[0], currPos[1]);
  console.setPosition(currPos[0], currPos[1] - 1);
 }else if(key == RIGHT){
  console.getPosition(currPos[0], currPos[1]);
  console.setPosition(currPos[0], currPos[1] + 1);
 } 
}while(key != ESCAPE);