In my console based Linux C++ application I want to get the size of the terminal (lines+columns) and the current cursor position. For the latter I think I could use the ANSI codes for that, but I am not sure how to parse it correctly. Also I don’t see how to get the size of the window?
For other reasons switching to ncurses is not an option at this time.
Old method of getting the size was termcap with the libtermcap. New is terminfo (+lib).
I would recommend to use a library that abstracts this (and all other terminal related stuff) away and use a terminal output library like (n)curses.
This will in addition also work on other Unix systems.