linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J." <mailing-lists@xs4all.nl>
To: linux-c-programming@vger.kernel.org
Cc: ameer armaly <ameer@charter.net>
Subject: Re: functions to determine dementions of console?
Date: Sun, 30 May 2004 21:12:32 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.21.0405302056120.30001-100000@hestia> (raw)
In-Reply-To: <Pine.LNX.4.58.0405231854400.11050@debian>

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 <stdio.h>
#include <term.h>
#include <ncurses.h>

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/



  parent reply	other threads:[~2004-05-30 19:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-23 23:05 functions to determine dementions of console? ameer armaly
2004-05-24  2:09 ` Glynn Clements
2004-05-26 14:41 ` Christoph Bussenius
2004-05-30 19:12 ` J. [this message]
2004-05-30 20:35   ` Micha Feigin
2004-05-31 19:38     ` Christoph Bussenius
2004-06-01  1:41       ` value computed is not used ?? J.
2004-06-01  3:25         ` Glynn Clements
2004-06-01  7:30         ` Charlie Gordon
2004-06-01 16:08           ` Charlie Gordon
2004-06-01 21:58           ` Glynn Clements
2004-06-03  1:26             ` Micha Feigin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.21.0405302056120.30001-100000@hestia \
    --to=mailing-lists@xs4all.nl \
    --cc=ameer@charter.net \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).