0

Tinkering with ncurses; can't seem to find why I would want to use getmaxyx() instead of LINES and COLS, or vice-versa.

It seems to me that LINES and COLS is already initialized by initscr(), so why would I want to go through the additional step of calling getmaxyx() and setting new variables?

1 Answers1

0

LINES and COLS are the size of the screen, while getmaxyx gives the size of a window. curses applications can have several windows (and rarely more than one screen).

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Ah, I never caught onto that. Thank you very much! – Debian_Fanatic Oct 11 '19 at 20:03
  • Looking more into it, I see that for the initial "stdscr" window that is created by the initscr() call, the LINES and COLS variables are equivalent to the X and Y of getmaxyx(), even after resizing the screen/window. So as long as you're dealing only with one window (the default window created by the initscr() call), I think you can use either method. But if you're dealing with other windows, you'll want to use getmaxyx(). – Debian_Fanatic Oct 14 '19 at 13:33