Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ NCurses how to get current cursor position?

How do I get the current position of the cursor in terminal with NCurses using C++? I searched around a bit and saw "getxy(int x, int y)". I tried that and got the error "'getxy' was not declared in this scope".

like image 667
Predictability Avatar asked Dec 09 '22 19:12

Predictability


2 Answers

You might have forgotten some #include <ncurses.h> and the macro is spelled getyx

Don't forget to compile with g++ -Wall -g and to link with -lncurses

like image 163
Basile Starynkevitch Avatar answered Dec 11 '22 08:12

Basile Starynkevitch


getyx(WINDOW *win,int y,int x);

not getxy().

like image 38
Joe Jevnik Avatar answered Dec 11 '22 08:12

Joe Jevnik