Monday 15 September 2014

c - Fetching the current console size -


I want to get the current console size in rows and columns. Using the function, I can get a structure that has the following:

  Type -FFIFICATE _CONSOLE_SCREEN_BUFFER_INFO {COORD dwSize; COORD dwCursorPosition; Features of Word; SMALL_RECT srWindow; COORD dwMaximumWindowSize; } CONSOLE_SCREEN_BUFFER_INFO;   

The nearest field is dwMaximumWindowSize , as the name suggests obtains the maximum window size. Is there no way that I get the size of the current window (i.e. the number of rows and columns)?

The size of the window is in the srWindow area:

srWindow

A SMALL_RECT structure that includes the top-left console screen buffer coordinates and the lower right corner of the display window.

No comments:

Post a Comment