#include #include #include int main( int argc, char **argv ) { struct winsize win = { 0, 0, 0, 0 }; int ret = ioctl(fileno(stdin), TIOCGWINSZ, &win); printf( "Width = %d, Height = %d\n", win.ws_col, win.ws_row ); return 0; }