How to get cursor position c++

#include <windows.h>
#include <iostream>

int main() {
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) {
        int column = csbi.dwCursorPosition.X;
        int row = csbi.dwCursorPosition.Y;
        std::cout << "Cursor position - Column: " << column << ", Row: " << row << std::endl;
    }
    return 0;
}