So I hav开发者_运维百科e these lines of code:
int maxY, maxX;
getmaxyx(stdscr, &maxY, &maxX);
It gives me the following error:
error C2440: '=' : cannot convert from 'int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
twice for each time I use it. I'm not even using the = operator! The curses.h file is included. What am I doing wrong?
getmaxyx
is a macro, which doesn't take int*, but int.
It resolves to something like
getmaxyx(S,Y,X) -> X=s->X, Y=s->Y
try
getmaxyx(stdscr, maxY, maxX); // without the & operator
see http://opengroup.org/onlinepubs/007908775/xcurses/getmaxyx.html
精彩评论