I\'m trying to retrieve the coordinates of cursor in a VT100 terminal using the following code:
void getCursor(int* x, int* y) {
printf(\"\\033[6n\");
s
I believe that you really get the expected response in stdin. But imagine what happens actually:
To avoid this use a getc() (==fgetc(stdin)) loop instead. If you encounter an ESC (0x1B) than dump the following characters in a string until you find the final delimiter of the ESC sequence (in your case 'n'). After that you may use sscanf(esqString, formatString, ...).
But before you encounter the loop you need to change with termios to raw mode (look at the code example below). Else nothing would be different.