home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!europa.asd.contel.com!emory!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfield
- From: fairfield@slacvx.slac.stanford.edu
- Subject: Re: Getting terminal width from VAX-C ?
- Message-ID: <1992Nov12.001100.1@slacvx.slac.stanford.edu>
- Lines: 25
- Sender: news@unixhub.SLAC.Stanford.EDU
- Organization: Stanford Linear Accelerator Center
- References: <1992Nov11.101009.87@front.se>
- Date: Thu, 12 Nov 1992 08:11:00 GMT
-
- In article <1992Nov11.101009.87@front.se>, samuel@front.se writes:
- > Hello
- > Does anybody out there know how to get the TERMINAL WIDTH from VAX-C ?
- > I'm implementing in VAX-C on VMS 5.4.
- > What I'm trying to do is the following :
- >
- > width = terminal_width(); /* Get terminal width */
- > sprintf(buf,"...",...); /* Write data into buffer */
- > if (strlen(buf) > width) /* Buffer too long ? */
- > strcpy(buf+width-3,"..."); /* ==> 'Truncate' buffer */
- > printf("%s\n",buf); /* Write [truncated] data to terminal */
-
- The key is to use the run time library routine LIB$GETDVI specifying
- the item DVI$_DEVBUFSIZ. The latter is defined in DVIDEF.H. Look in the
- online HELP for the calling sequence for the former: HELP RTL LIB LIB$GETDVI.
- And pay attention to the argument passing mechanism for each argument as
- documented there...
-
- Cheers, Ken
- --
- Dr. Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu
- SLAC, P.O.Box 4349, MS 98 | DECnet: 45537::FAIRFIELD (45537=SLACVX)
- Stanford, CA 94309 | BITNET Fairfield@Slacvx
- ----------------------------------------------------------------------------
- These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
-