how to get cursor position c 2b 2b

Solutions on MaxInterview for how to get cursor position c 2b 2b by the best coders in the world

showing results for - "how to get cursor position c 2b 2b"
Nael
22 Mar 2018
1COORD GetConsoleCursorPosition(HANDLE hConsoleOutput)
2{
3    CONSOLE_SCREEN_BUFFER_INFO cbsi;
4    if (GetConsoleScreenBufferInfo(hConsoleOutput, &cbsi))
5    {
6        return cbsi.dwCursorPosition;
7    }
8    else
9    {
10        // The function failed. Call GetLastError() for details.
11        COORD invalid = { 0, 0 };
12        return invalid;
13    }
14}
15
Mattia
04 Apr 2018
1POINT p;
2if (GetCursorPos(&p))
3{
4    //cursor position now in p.x and p.y
5}