docs
[mirrors/Programs.git] / c / winsize.c
1 /*
2 * Prints size of terminal window in characters
3 */
4
5 #include <stdio.h>
6 #include <sys/ioctl.h>
7
8 static int get_win_size (int fd, struct winsize *win)
9 {
10 return ioctl (fd, TIOCGWINSZ, (char *) win);
11 }
12
13 int main(void) {
14 struct winsize win;
15 if(!get_win_size(1, &win)) puts("Error!");
16 printf("%d %d :-)\n", win.ws_row, win.ws_col);
17 }
This page took 0.259307 seconds and 4 git commands to generate.