Text mode screen size max. compatibility
A. Wright
andrew at qemg.org
Fri Jul 23 18:44:30 UTC 2010
On Fri, 23 Jul 2010, Polytropon wrote:
> Is there a way to easily determine the terminal output size at
> program startup so the program can be preconfigured for certain
> screen sizes, and even refuse to run if it's less than 80x25?
The "curses" library will do this. The variables LINES and COLS
will tell you what you want.
#include <curses.h>
main()
{
initscr();
printw("LINES = %d, COLS=%d -- press a key to quit\n", LINES, COLS);
refresh();
getch();
endwin();
exit(0);
}
A.
More information about the freebsd-questions
mailing list