From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,65b8635f54891f76,start X-Google-Attributes: gidfee84,public From: Peter Neilley Subject: How to get the terminal size? Date: 1997/06/19 Message-ID: <33A9C031.288D015F@ucar.edu>#1/1 X-Deja-AN: 251202348 X-Priority: 3 (Normal) Organization: National Center for Atmospheric Research/Boulder, CO Newsgroups: comp.unix.osf.osf1 Newbie here... I'm porting code developed on a SunOS/Solaris/IRIX/HP/Ultrix/LINUX, etc. platforms
to a Digital Unix machine.  I need to know how to get the current terminal size (rows/columns)
without having to resort to using the curses lib.  On the previous systems I used an ioctl call (see below),
but this doesn't seem to be supported under Digital Unix.  I'm working very remotely from the machine
(and manuals) so if  someone could help, I'd appreciate it.
----------------------
Elements of code for getting terminal size that doesn't seem to be supported on Digital Unix:

struct winsiz WINSIZ;
int TERM_FD;
.
.
if ( TERM_FD = open("/dev/tty",O_RDWR) ......
.
.
if ( ioctl(TERM_FD,TIOCGWINSZ,&WINSIZ) == 0 )
  {
   *lines = WINSIZ.ws_row;
   *cols = WINSIZ.ws_col;
.
.

 
-- 
Peter Neilley, NCAR/RAP
neilley@ucar.edu