1#include <sys/ioctl.h>
2#include <stdio.h>
3#include <unistd.h>
4
5int main (int argc, char **argv)
6{
7 struct winsize w;
8 ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
9
10 printf ("lines %d\n", w.ws_row);
11 printf ("columns %d\n", w.ws_col);
12 return 0; // make sure your main returns int
13}
14