terminal window 등에서 보면 창 크기에 따라서 출력이 달라지잖아요. 전체화면에서 ls 명령하면 10개의 화일 목록이 한 줄로 나오고 작게하면 그 크기에 따라서 2줄, 3줄... 이렇게 창 크기에 맞춰서 출력이 되게 하는 방법이 궁금해서요. 아시는분 도움 부탁합니다.
이걸써보세요..
#include <stdio.h> #include <sys/ioctl.h> main() { int fd; // = fileno(stdin); struct winsize ws; fd = fileno(stdin); if( ioctl( fd, TIOCGWINSZ, & ws ) == -1 ) { printf("error!\n"); return; } printf("col = %d, raw = %d\n", ws.ws_col, ws.ws_row ); }
답변 감사합니다. 꾸벅^0^
Heading, heading again, again, ... ㅜㅜ 피난다
이걸써보세요.. [code:1]#include <stdi
이걸써보세요..
#include <stdio.h> #include <sys/ioctl.h> main() { int fd; // = fileno(stdin); struct winsize ws; fd = fileno(stdin); if( ioctl( fd, TIOCGWINSZ, & ws ) == -1 ) { printf("error!\n"); return; } printf("col = %d, raw = %d\n", ws.ws_col, ws.ws_row ); }좋은 정보...^^
답변 감사합니다. 꾸벅^0^
Heading, heading again, again, ... ㅜㅜ 피난다