Rozmiary terminala

0

Witam!
Czy wiecie jak w Unixie pobrac w programie do zmiennej rozmiary terminala?

Pozdrawiam

0
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <unistd.h>

int
main (void)
{
  struct winsize ws;
  
  if (ioctl (STDIN_FILENO, TIOCGWINSZ, &ws) < 0)
        {
          fprintf (stderr, "%s\n", strerror (errno));
          exit (1);
        }
  printf ("%d wierszy, %d kolumn\n", ws.ws_row, ws.ws_col);
  
  exit (0);
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1