How to get the cursor position in a C program using termcap, without writing a character?
I would like to know how to get the cursor position (x, y) in my program, without writing anything on the screen neither tracking it all the time. I found out a way to get its position with this function (I don't check the return of read, write, etc here to write a smaller code on this subject but I do it in my program) : void get_cursor_position(int *col, int *rows) { int a = 0; int i = 0; char buf[4] write(1, "\033[6n", 4); // string asking for the cursor position read(1, buf, 4); while (buf[i]) { if (buf[i] >= 48 && buf[i] <= 57) { if (a == 0) *rows = atoi(&buf[i]) - 1; else *col = atoi(&