From owner-freebsd-questions@FreeBSD.ORG Fri Jul 23 18:44:30 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75204106566B for ; Fri, 23 Jul 2010 18:44:30 +0000 (UTC) (envelope-from ahamiltonwright@mta.ca) Received: from smtpx.mta.ca (smtpx.mta.ca [138.73.1.138]) by mx1.freebsd.org (Postfix) with ESMTP id 4714A8FC22 for ; Fri, 23 Jul 2010 18:44:29 +0000 (UTC) Received: from [138.73.29.51] (port=49198 helo=qemg.org) by smtpx.mta.ca with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.71) (envelope-from ) id 1OcNER-0001tP-Up; Fri, 23 Jul 2010 15:44:27 -0300 Date: Fri, 23 Jul 2010 15:44:27 -0300 (ADT) From: "A. Wright" To: Polytropon In-Reply-To: <20100723202450.ea80c86f.freebsd@edvax.de> Message-ID: References: <20100723202450.ea80c86f.freebsd@edvax.de> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: ahamiltonwright@mta.ca Cc: FreeBSD Questions Subject: Re: Text mode screen size max. compatibility X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2010 18:44:30 -0000 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 main() { initscr(); printw("LINES = %d, COLS=%d -- press a key to quit\n", LINES, COLS); refresh(); getch(); endwin(); exit(0); } A.