Index: [thread] [date] [subject] [author]
  From: Andrew Apted <ajapted@netspace.net.au>
  To  : ggi-develop@eskimo.com
  Date: Sun, 2 Aug 1998 01:26:41 +1000

Re: bughunting

Jan writes:

>  > >       2. hwoto find out the size of the console ??
>  > 
>  > One possibility: open("/dev/tty") and issue the TIOCGWINSZ ioctl.  I can
>  > send more info if you like.
>  yes, please.

Something like this (untested) :

    #include <stdio.h>
    #include <termios.h>

    void main(void)
    {
        struct winsize w;

        int fd = open("/dev/tty", O_RDWR);

        ioctl(fd, TIOCGWINSZ, &w);

        printf("Size is %dx%d (pixels %dx%d)\n",
                w.ws_col, w.ws_row, w.ws_xpixel, w.ws_ypixel);

	close(fd);
    }

Cheers,
_____________________________________________  ____
                                               \  /
  Andrew Apted   <andrew@ggi-project.org>       \/
  

Index: [thread] [date] [subject] [author]