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