Friday 1 February 2013

one-line display function solution

  Thank to Gary's solution giving me idea.
  I have tested it. If there is any bug, just tell me.

This is Gary's link: http://garydeng.tumblr.com/



  void Console::display(const char* str, int row, int col, int fieldLen){

      for(setPos(row, col),row=0;fieldLen==0?(str[row] != 0):(row<fieldLen);row<strlen(str)?(putChar(str[row])):(putChar(' ')),row++);
  
  }

2 comments: