

$ who > /dev/pts/1
-> who의 출력 결과가 /dev/pts/1에 출력됨
struct termios
{
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_cc[NCCS]; /* control charters */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
};
#include <stdio.h>
#include <sys/ioctl.h>
int main(){
struct winsize wbuf;
if (ioctl(0, TIOCGWINSZ, &wbuf) != -1){
printf("%d rows x %d cols\n", wbuf.ws_row, wbuf.ws_col);
printf("%d wide x %d tall\n", wbuf.ws_xpixel, wbuf.ws_ypixel);
}
return 0;
}
