Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2010 15:44:27 -0300 (ADT)
From:      "A. Wright" <andrew@qemg.org>
To:        Polytropon <freebsd@edvax.de>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Text mode screen size max. compatibility
Message-ID:  <alpine.BSF.2.00.1007231535211.1633@qemg.org>
In-Reply-To: <20100723202450.ea80c86f.freebsd@edvax.de>
References:  <20100723202450.ea80c86f.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help

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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1007231535211.1633>