This can be done with the escape code ESC[6n. The terminal will respond with a code of the form ESC[r;cR, where r is the row and c is the column.
I don't know of any way to do this via the termios API. The implementation of the Termion method could provide some inspiration.
This can be done with the escape code
ESC[6n. The terminal will respond with a code of the formESC[r;cR, whereris the row andcis the column.I don't know of any way to do this via the termios API. The implementation of the Termion method could provide some inspiration.