How do I determine size of ANSI terminal?
问题 Standard input and output are connected to a terminal that implements ANSI escape sequences, but is of unknown dimensions. I need to know how big the terminal so to facilitate drawing a full-screen text UI on it. How can I get the size? The correct size is not loaded into environment variables. I cannot use TIOCGETS; the the call would return success but the values are not correct -- the kernel doesn't know the size either. There are lots and lots of answers searching stackoverflow, but they