标签:des style blog color io 2014 ar div
/* *@author cody *@date 2014-08-12 *@description */ /* #include <sys/ioctl.h> send control and config order to device int ioctl(int d,int request,...); params d -- file descriptor request ---ioctl order */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/ioctl.h> void GetTernimalSize(){ struct winsize size; if(isatty(STDOUT_FILENO) == 0){ exit(1); } if(ioctl(STDOUT_FILENO,TIOCGWINSZ,&size) < 0){ perror("ioctl error"); exit(1); } printf("%d rows,%d columns\n",size.ws_row,size.ws_col ); } int main(int argc, char const *argv[]) { GetTernimalSize(); return 0; }
标签:des style blog color io 2014 ar div
原文地址:http://www.cnblogs.com/cody1988/p/3907278.html