Commands written in the form of Esc sequences are widely used on the Linux console. It is very simple to send a similar command from a console application, just write something like print (screen, "E [6n") and the command "Show current cursor position" will go exactly where it should be, and the console will respond immediately by displaying the message - ^ [[20; 30R - which begins just at the current cursor position and means "line 20, column 30".
But I need to intercept this console report so that it doesn’t get on the screen, and the donkey is in any variable in my console application in order to use this data to organize further output of text in the console window.
The problem arose because, if you output Russian text in the utf-8 encoding to the console, the usual functions like get_cursor_position () on the two-byte encoding are lost and output the wrong cursor position value, and the Esc command gives you exactly what I need.
Thank!