From 727f785a36a56222107856e8f5c97ed6bf73cd2b Mon Sep 17 00:00:00 2001 From: anon Date: Sun, 10 Mar 2024 15:57:36 +0100 Subject: [PATCH] Added screen_size_(without_curses).c --- screen_size_(without_curses).c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 screen_size_(without_curses).c diff --git a/screen_size_(without_curses).c b/screen_size_(without_curses).c new file mode 100644 index 0000000..b236182 --- /dev/null +++ b/screen_size_(without_curses).c @@ -0,0 +1,24 @@ +#include +#include +#include + +#include + + +signed main(){ + /* struct winsize{ + unsigned short int ws_row; + unsigned short int ws_col; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; + }; */ + struct winsize ws; + + int fd = open("/dev/tty", O_WRONLY); + ioctl(fd, TIOCGWINSZ, &ws); + close(fd); + + printf("%dx%d", ws.ws_col, ws.ws_row); + + return 0; +}