我想获取当前控制台的行和列大小。使用GetConsoleScreenBufferInfo函数我可以获得 CONSOLE_SCREEN_BUFFER_INFO其结构如下:
typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
COORD dwSize;
COORD dwCursorPosition;
WORD wAttributes;
SMALL_RECT srWindow;
COORD dwMaximumWindowSize;
} CONSOLE_SCREEN_BUFFER_INFO;
最接近的字段是dwMaximumWindowSize
,顾名思义,它获取最大窗口大小。有没有办法获取当前窗口大小(即行数和列数)?
最佳答案
窗口的大小位于srWindow
字段中:
srWindow
A SMALL_RECT structure that contains the console screen buffer coordinates of the upper-left and lower-right corners of the display window.
关于c - 获取当前控制台大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15646461/