GetTIOCGWINSZ.c 410 B

1234567891011
  1. #include <stdio.h>
  2. #include <sys/ioctl.h>
  3. // This function is used to get the value of the TIOCGWINSZ variable,
  4. // which may have different values ​​on different Unix operating systems.
  5. // In Linux=0x005413, in Darwin and OpenBSD=0x40087468,
  6. // In Solaris=0x005468
  7. // The best solution is having a function that get the real value of the current OS
  8. int get_tiocgwinsz_value() {
  9. return TIOCGWINSZ;
  10. }