CPlay/winsz.c
2025-08-27 00:12:57 +02:00

17 lines
314 B
C

#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
int main(void) {
struct winsize w;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == -1) {
perror("ioctl");
return 1;
}
printf("Rows (height): %d\n", w.ws_row);
printf("Cols (width): %d\n", w.ws_col);
return 0;
}