Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: net.lang.c Subject: Re: Another printf-type question Message-ID: <2153@brl-smoke.ARPA> Date: Sat, 12-Jul-86 09:40:40 EDT Article-I.D.: brl-smok.2153 Posted: Sat Jul 12 09:40:40 1986 Date-Received: Sun, 13-Jul-86 06:58:43 EDT References: <2138@brl-smoke.ARPA> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 39 In article <2138@brl-smoke.ARPA> LINNDR%VUENGVAX.BITNET@WISCVM.ARPA writes: >invprintf(fmt,args) >{ > printf(); > printf(fmt,args); > printf(); >} > >This simple solution didn't work. Oh great gurus of such things, what >should I have done? Assuming you're using UNIX System V Release 2.0 for sake of concreteness, #include #include void invprintf( va_alist ) va_dcl { char *fmt; /* printf control string */ va_list args; /* argument pointer */ (void)fputs( "string to enter inverse video mode", stdout ); va_start( args ); fmt = va_arg( args, char * ); (void)vprintf( fmt, args ); /* warning! not printf(va_arg etc. */ va_end( args ); (void)fputs( "string to leave inverse video mode", stdout ); } The final mechanism of ANSI X3J11 will probably be slightly different. P.S. You should perhaps also test whether the write to the terminal succeeds.