From: Peter Neilley <neilley@ucar.edu>
Subject: How to get the terminal size?
Date: 1997/06/19 [thread overview]
Message-ID: <33A9C031.288D015F@ucar.edu> (raw)
<HTML>
Newbie here... I'm porting code developed on a SunOS/Solaris/IRIX/HP/Ultrix/LINUX,
etc. platforms
<BR>to a Digital Unix machine. I need to know how to get the
current terminal size (rows/columns)
<BR>without having to resort to using the curses lib. On the previous
systems I used an ioctl call (see below),
<BR>but this doesn't seem to be supported under Digital Unix. I'm
working very remotely from the machine
<BR>(and manuals) so if someone could help, I'd appreciate it.
<BR>----------------------
<BR>Elements of code for getting terminal size that doesn't seem to be
supported on Digital Unix:
<P>struct winsiz WINSIZ;
<BR>int TERM_FD;
<BR>.
<BR>.
<BR>if ( TERM_FD = open("/dev/tty",O_RDWR) ......
<BR>.
<BR>.
<BR>if ( ioctl(TERM_FD,TIOCGWINSZ,&WINSIZ) == 0 )
<BR> {
<BR> *lines = WINSIZ.ws_row;
<BR> *cols = WINSIZ.ws_col;
<BR>.
<BR>.
<BR>
<PRE>
--
Peter Neilley, NCAR/RAP
neilley@ucar.edu</PRE>
</HTML>
reply other threads:[~1997-06-19 4:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox