]> gitweb.ps.run Git - iftint/commitdiff
termsize windows
authorPatrick <patrick.schoenberger@posteo.de>
Sat, 29 Jul 2023 12:33:20 +0000 (14:33 +0200)
committerPatrick <patrick.schoenberger@posteo.de>
Sat, 29 Jul 2023 12:33:20 +0000 (14:33 +0200)
termsize.c

index 83a0158d4a881f3e962de5f21c27f72440fbc394..1c0f61b7cfd7c9aa4f614724353d20c863975d2c 100644 (file)
@@ -12,3 +12,18 @@ int main (int argc, char **argv)
     return 0;  // make sure your main returns int
 }
 
+#include <windows.h>
+
+int main(int argc, char *argv[]) 
+{
+    CONSOLE_SCREEN_BUFFER_INFO csbi;
+    int columns, rows;
+  
+    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
+    columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
+    rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
+  
+    printf("columns: %d\n", columns);
+    printf("rows: %d\n", rows);
+    return 0;
+}