From d579d3407263e3cd9bd62e78ef8c1deed1c7ed1e Mon Sep 17 00:00:00 2001 From: MuedeHydra Date: Mon, 9 Dec 2024 10:11:07 +0100 Subject: [PATCH] add terminal size --- src/main.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 2bf9181..dcca5f4 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,7 @@ #include #include +#include +#include // import sub programme #include "test_prog.h" @@ -15,8 +17,30 @@ Datum: 04.12.2024 0.1 04.12.2024 Dokument erstellt */ -int main(){ - int x = test_gruppe_programmname(); +int terminal_size (int argc, char **argv) +{ + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + + printf ("lines %d\n", w.ws_row); + printf ("columns %d\n", w.ws_col); + return 0; // make sure your main returns int +} + + +int main(int argc, char **argv){ + // int x = test_gruppe_programmname(); + + // int terminal_size(); + + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + + printf ("lines %d\n", w.ws_row); + printf ("columns %d\n", w.ws_col); + + + return 0; }