* How to get the terminal size?
@ 1997-06-19 4:00 Peter Neilley
0 siblings, 0 replies; only message in thread
From: Peter Neilley @ 1997-06-19 4:00 UTC (permalink / 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>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-06-19 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-06-19 4:00 How to get the terminal size? Peter Neilley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox