Answers for "how to fix the terminal size in c"

C
2

terminal size in c

#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>

int main (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
}
Posted by: Guest on December-21-2020

Code answers related to "how to fix the terminal size in c"

Code answers related to "C"

Browse Popular Code Answers by Language