'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".



Solution 1:[1]

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

Solution 2:[2]

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

not getxy().

Solution 3:[3]

This function only allow you to set the cursor to position, you should look at the getmouse function to get the mouse event.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Basile Starynkevitch
Solution 2 Joe Jevnik
Solution 3 Sleey