blob: 556dfa0b9d8cc0ebaf2abdfcc71dd9d29d4ab87a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <sys/ioctl.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
int
main(int argc,char **argv)
{
struct winsize ws;
if (ioctl(0,TIOCGWINSZ,&ws)!=0) {
fprintf(stderr,"TIOCGWINSZ:%s\n",strerror(errno));
exit(1);
}
printf("row=%d, col=%d, xpixel=%d, ypixel=%d\n",
ws.ws_row,ws.ws_col,ws.ws_xpixel,ws.ws_ypixel);
return 0;
}
|