Search

четверг, 22 сентября 2011 г.

Solved Design

So, it took me a few hours, but I found out what the problem was. And obviously it wasn't compiler's fault.
Basically the error was:
 error LNK2019: unresolved external symbol "public: void __thiscall cio::Console::display(char const *,int,int,int)" (?display@Console@cio@@QAEXPBDHHH@Z)
And the code I wrote was:
void display (const char* str, int row, int col, int fieldLen) 
  After a few hours of looking at the screen I realized what a stupid mistake I made. The right line of the code was supposed to be:
  void Console::display (const char* str, int row, int col, int fieldLen) 
 Now this seems obvious but I spend A Lot of time on this bag, just looking in the wrong direction.
The rest wasn't that hard. I had tree situations:
1.  If fieldLen is 0 or less.
 Just one cout and everything works.

2.  If fieldLen more then sting length.
Make another string, and fill it with spaces and print after the str sting. (I'm also thinking about doing another version of it without creating another string of spaces)
3.  If fieldLen less then sting length.
Make another string, and copy str to it. And the Cut it with Null value, and print it.
I might also take some time and think about other ways  of writing it.

Комментариев нет:

Отправить комментарий