I want to get terminal cursor position with ansi escape sequence codes. I saw this source and I thought I can get terminal cursor position but when I try in c I can't even get this variables.
I tried this code:
#include <stdio.h>
int main()
{
printf("\033[%d;%dH", 10, 11); // I set cursor position to x=10, y=11
printf("\033[6n"); // This only print like '^[[11;10R'
scanf("\033[%d;%dR", x, y); // It didn't even worked
printf("\n%d, %d\n", x, y); // Also didn't worked
return 0;
}
I don't want to use ncurses library or windows/linux dependency codes. I research in all revelant stackoverflow topics but I didn't see an answer. Also you can recommend another ways I just don't want to use library or os based codes. I'm currently working to make a terminal application in c if I can get terminal cursor position it would be great.