From: Micha Feigin <michf@post.tau.ac.il>
To: linux-c-programming@vger.kernel.org
Subject: Re: functions to determine dementions of console?
Date: Sun, 30 May 2004 23:35:18 +0300 [thread overview]
Message-ID: <20040530203518.GH7410@luna.mooo.com> (raw)
In-Reply-To: <Pine.LNX.4.21.0405302056120.30001-100000@hestia>
On Sun, May 30, 2004 at 09:12:32PM +0200, J. wrote:
> 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.
> >
Its usually done using the environment variables in COLUMNS, AFAIK. They
appear after the first null of argv IIRC.
> > 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/
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> +++++++++++++++++++++++++++++++++++++++++++
> This Mail Was Scanned By Mail-seCure System
> at the Tel-Aviv University CC.
>
next prev parent reply other threads:[~2004-05-30 20:35 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.
2004-05-30 20:35 ` Micha Feigin [this message]
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=20040530203518.GH7410@luna.mooo.com \
--to=michf@post.tau.ac.il \
--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).