From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J." Subject: Re: functions to determine dementions of console? Date: Sun, 30 May 2004 21:12:32 +0200 (CEST) Sender: linux-c-programming-owner@vger.kernel.org Message-ID: References: Mime-Version: 1.0 Return-path: In-Reply-To: List-Id: Content-Type: TEXT/PLAIN; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-c-programming@vger.kernel.org Cc: ameer armaly On Sun, 23 May 2004, ameer armaly wrote: > Hi all. > I was wondering if there are a set of functions/system calles to let me > know what someone's set their tty length and heighth too? I do this > because I don't want to presume 80x25 in case someone's got it set > otherwise. > > Ameer on the console the command `stty -a` will print: speed 9600 baud; rows 33; columns 89; line = 0; .... .... etc.. For a c program have a look at the term manpage and use the settings from 'terminfo' #include #include #include int main(void) { int num_rows = 0, num_columns = 0; setupterm(NULL, fileno(stdout), (int *)0); num_rows = tigetnum("lines"); num_columns = tigetnum("cols"); printf("terminal:\ncolumns: %d\nrows %d\n", num_columns, num_rows); return 0; } etc..... G00dlUcK..... Jeroen Reynders. -- http://www.xs4all.nl/~winnetou/