Predictability
Predictability

Reputation: 3129

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

Upvotes: 5

Views: 17447

Answers (3)

Sleey
Sleey

Reputation: 1

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

Upvotes: 0

Joe Jevnik
Joe Jevnik

Reputation: 81

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

not getxy().

Upvotes: 6

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

Upvotes: 8

Related Questions