Added screen_size_(without_curses).c
This commit is contained in:
parent
3a2b229cc0
commit
727f785a36
24
screen_size_(without_curses).c
Normal file
24
screen_size_(without_curses).c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user